civis.civis_logger
- civis.civis_logger(name=None, level=None, fmt='%(message)s')[source]
Return a logger for Civis Platform jobs.
The logs of Civis Platform jobs format stdout in black and stderr in red. This logger sends INFO-level (or below) logging to stdout (black), and other levels’ logging (WARNING, etc.) to stderr (red).
- Parameters:
- namestr, optional
Logger name, to be passed into
logging.getLogger()
. IfNone
or not provided,__name__
of the module where this logger is instantiated is used.- levelint or str, optional
Level from which logging is done, see https://docs.python.org/3/library/logging.html#logging-levels. If
None
or not provided, the level specified by the environment variableCIVIS_LOG_LEVEL
is used (e.g.,export CIVIS_LOG_LEVEL=DEBUG
). If this environment variable is also not given, the logging level defaults tologging.INFO
.- fmtstr or logging.Formatter, optional
Logging format. The default is
"%(message)s"
. For the attributes that can be formatted, see: https://docs.python.org/3/library/logging.html#logrecord-objects Alternatively, you may pass in alogging.Formatter
instance for more custom formatting.
- Returns: