refactoring logger at sample