celery.utils.log

Logging utilities.

class celery.utils.log.ColorFormatter(fmt=None, use_color=True)[исходный код]

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)[исходный код]

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.

formatException(ei)[исходный код]

Format and return the specified exception information as a string.

This default implementation just uses traceback.print_exception()

class celery.utils.log.LoggingProxy(logger, loglevel=None)[исходный код]

Forward file object to logging.Logger instance.

Параметры:
  • logger (Logger) – Logger instance to forward to.

  • loglevel (int, str) – Log level to use when logging messages.

close()[исходный код]
closed = False
flush()[исходный код]
isatty()[исходный код]

Here for file support.

loglevel = 40
mode = 'w'
name = None
write(data: AnyStr) int[исходный код]

Write message to logging object.

writelines(sequence: Sequence[str]) None[исходный код]

Write list of strings to file.

The sequence can be any iterable object producing strings. This is equivalent to calling write() for each string.

celery.utils.log.get_logger(name)[исходный код]

Get logger by name.

celery.utils.log.get_multiprocessing_logger()[исходный код]

Return the multiprocessing logger.

celery.utils.log.get_task_logger(name)[исходный код]

Get logger for task module by name.

celery.utils.log.in_sighandler()[исходный код]

Context that records that we are in a signal handler.

celery.utils.log.mlevel(level)[исходный код]

Convert level name/int to log level.

celery.utils.log.reset_multiprocessing_logger()[исходный код]

Reset multiprocessing logging setup.

celery.utils.log.set_in_sighandler(value)[исходный код]

Set flag signifiying that we’re inside a signal handler.

Back to Top