log messages properly