added option to log messages