Context-based logger and formatter