Meaning
A decorator that adds logging to a function or method.
Primary Function
Adds logging (entry/exit, arguments, return value, exceptions) to a callable.
Communicative Purpose
Indicates that the decorated callable should emit log messages for debugging or monitoring.
Pattern
@logger
Core Structure
@logger
Função primária
Adds logging (entry/exit, arguments, return value, exceptions) to a callable.
Propósito comunicativo
Indicates that the decorated callable should emit log messages for debugging or monitoring.
Situações de gatilho
When you need to trace function calls, log arguments and return values, or monitor exceptions without modifying the function body.
Contextos
Used on Python functions, methods, class methods, or any callable where logging is desired.
Padrão
@logger
Estrutura central
@logger
Colocados típicos
- function
- method
- class
Erros comuns
forgetting to import logger, using print instead of logger, applying to a class instead of a method
Similar / contraste
@staticmethod, @property, @dataclass
Interferências
confusing with built-in logging decorators, forgetting to configure the logger
Família do chunk
- python decorators
- logging decorators
Nuance
Adds entry/exit logging; can be configured for log level and logger name.
Efeito pragmático
Indicates that the decorated callable should emit log messages for debugging/monitoring.
Dica de memória
@logger reminds to log function entry/exit.
Upgrade path
@structured_logger
Log in to save chunks.