Logging, context and decorator refactoring