This document describes the current stable version of Celery (5.2). For development docs, go here.
celery.utils.log
¶
Logging utilities.
- class celery.utils.log.ColorFormatter(fmt=None, use_color=True)[source]¶
Logging formatter that adds colors based on severity.
- COLORS = {'black': <bound method colored.black of ''>, 'blue': <bound method colored.blue of ''>, 'cyan': <bound method colored.cyan of ''>, 'green': <bound method colored.green of ''>, 'magenta': <bound method colored.magenta of ''>, 'red': <bound method colored.red of ''>, 'white': <bound method colored.white of ''>, 'yellow': <bound method colored.yellow of ''>}¶
Loglevel -> Color mapping.
- colors = {'CRITICAL': <bound method colored.magenta of ''>, 'DEBUG': <bound method colored.blue of ''>, 'ERROR': <bound method colored.red of ''>, 'WARNING': <bound method colored.yellow of ''>}¶
- format(record)[source]¶
Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.