Improve logging.
part of #130.