Replace prints with loggging