logging

Common logging related functions.

class CustomLogger(name, level=0)[source]

Bases: Logger

Custom implementation of the logging.Logger class with an added trace method.

trace(msg, *args, **kwargs)[source]

Log the given message with the severity "TRACE".

To pass exception information, use the keyword argument exc_info with a true value:

logger.trace("Houston, we have an %s", "interesting problem", exc_info=1)
Parameters:
  • msg (str) – The message to be logged.

  • args – Passed to the base log function as is.

  • kwargs – Passed to the base log function as is.

Return type:

None

get_logger(name=None)[source]

Utility to make mypy recognise that logger is of type CustomLogger.

Parameters:

name (str | None) – The name given to the logger.

Return type:

CustomLogger

Returns:

An instance of the CustomLogger class.

log_format[source]

A logging.Formatter that can be used to standardise logging across all projects using pydis_core.