core.logging

Module Contents

Classes

ViURDefaultLogger

This is the ViUR-customized CloudLoggingHandler

ViURLocalFormatter

This is a formatter that injects console color sequences for debug output.

Attributes

client

requestLogger

requestLoggingRessource

logger

excluded_logger

handler

class core.logging.ViURDefaultLogger

Bases: google.cloud.logging.handlers.CloudLoggingHandler

This is the ViUR-customized CloudLoggingHandler

emit(record: logging.LogRecord)
class core.logging.ViURLocalFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)

Bases: logging.Formatter

This is a formatter that injects console color sequences for debug output.

The formatting can be modified using environment variables as follows:

  • VIUR_LOGGING_COLORIZATION can be either FULL (colorize full line) or DECENT (colorize debug level only)

  • VIUR_LOGGING_COLOR_DEBUG set debug level color

  • VIUR_LOGGING_COLOR_INFO set info level color

  • VIUR_LOGGING_COLOR_WARNING set warning level color

  • VIUR_LOGGING_COLOR_ERROR set error level color

  • VIUR_LOGGING_COLOR_CRITICAL set critical error level color

The colors can be “black”, “red”, “green”, “yellow”, “blue”, “magenta”, “cyan” and “white”.

Example configuration using viur-cli `sh VIUR_LOGGING_COLOR_WARNING=red VIUR_LOGGING_COLORIZATION=decent pipenv run viur run develop `

For details on console coloring, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors.

COLORS
DEFAULTS
static colorize(level: str, text: str) str

Retrieving colors for given debug level, either from environment or by default.

format(record: logging.LogRecord) str

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.

core.logging.client
core.logging.requestLogger
core.logging.requestLoggingRessource
core.logging.logger
core.logging.excluded_logger
core.logging.handler