added log handler and unit tests