alogging.logger module¶
-
alogging.logger.
a
(*args)[source]¶ Log the args of ‘a’ and returns the args.
Basically, log info about whatever it wraps, but returns it so it can continue to be callled.
Parameters: args (tuple) – The args to pass through to whatever is wrapped Returns: (tuple): The args that were passed in.
-
alogging.logger.
app_setup
(name=None)[source]¶ Call this to setup a default logging setup in a script or apps __main__
This will create a root logger with some default handlers, as well as a logger for ‘name’ if provided.
Parameters: name – (str): If provided, create a logging.Logger with this name
-
alogging.logger.
get_class_logger
(obj, depth=2)[source]¶ Use to get a logger with name equiv to module.Class
in a regular class __init__, use like:
self.log = alogging.get_class_logger(self)In a metaclass __new__, use like:
log = alogging.get_class_logger(cls)
-
alogging.logger.
get_class_logger_name
(obj, depth=None)[source]¶ Use to get a logger name equiv to module.Class
-
alogging.logger.
get_logger
(name=None, depth=2)[source]¶ Use to get a logger with name of callers __name__
Can be used in place of:
import logging log = logging.getLogger(__name__)That can be replaced with
import alogging log = alogging.get_logger()Parameters: - name (str) – Optional logger name to use to override the default one chosen automatically.
- depth (int) – Optional depth of stack to influence where get_logger looks to automatically choose a logger name. Default is 2.
Returns: A logger
Return type: logging.Logger
-
alogging.logger.
module_setup
(name=None, use_root_logger=False)[source]¶ Call this to setup a default log setup from a library or module.
ie, where the app itself may be setting up handlers, root logger, etc