Replace prints with logging