Logging helpers¶
-
barbeque.logging.
logged
(obj)¶ Decorator to mark a object as logged.
This injects a
logger
instance intoobj
to make log statements local and correctly named.Example:
>>> @logged ... class MyClass(object): ... def foo(self): ... self.logger.warning('logged') ... >>> import logging >>> logging.basicConfig() >>> obj = MyClass() >>> obj.foo() WARNING:__main__.MyClass:logged
Supported objects:
- Functions
- Methods
- Classes
- Raw names (e.g, user at module level)
-
barbeque.logging.
get_logger
(obj)¶ Return a logger object with the proper module path for
obj
.