celery.app.log

Logging configuration.

The Celery instances logging section: Celery.log.

Sets up logging for the worker and other programs, redirects standard outs, colors log output, patches logging related compatibility fixes, and so on.

class celery.app.log.Logging(app)[исходный код]

Application logging setup (app.log).

already_setup = False
colored(logfile=None, enabled=None)[исходный код]
get_default_logger(name='celery', **kwargs)[исходный код]
redirect_stdouts(loglevel=None, name='celery.redirected')[исходный код]
redirect_stdouts_to_logger(logger, loglevel=None, stdout=True, stderr=True)[исходный код]

Redirect sys.stdout and sys.stderr to logger.

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

  • loglevel (int, str) – The loglevel redirected message will be logged as.

setup(loglevel=None, logfile=None, redirect_stdouts=False, redirect_level='WARNING', colorize=None, hostname=None)[исходный код]
setup_handlers(logger, logfile, format, colorize, formatter=<class 'celery.utils.log.ColorFormatter'>, **kwargs)[исходный код]
setup_logging_subsystem(loglevel=None, logfile=None, format=None, colorize=None, hostname=None, **kwargs)[исходный код]
setup_task_loggers(loglevel=None, logfile=None, format=None, colorize=None, propagate=False, **kwargs)[исходный код]

Setup the task logger.

If logfile is not specified, then sys.stderr is used.

Will return the base task logger object.

supports_color(colorize=None, logfile=None)[исходный код]
class celery.app.log.TaskFormatter(fmt=None, use_color=True)[исходный код]

Formatter for tasks, adding the task name and id.

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.

Back to Top