refactoring: function to create logger