Improve logging.

Suggested by: Anton Juzhaninov