refactored logging example