PrecisionLogFormatter

class lsst.daf.butler.cli.cliLog.PrecisionLogFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)

Bases: logging.Formatter

A log formatter that issues accurate timezone-aware timestamps.

Attributes Summary

default_msec_format
default_time_format
use_local Control whether local time is displayed instead of UTC.

Methods Summary

converter timestamp[, tz] -> tz’s local time from POSIX timestamp.
format(record) Format the specified record as text.
formatException(ei) Format and return the specified exception information as a string.
formatMessage(record)
formatStack(stack_info) This method is provided as an extension point for specialized formatting of stack information.
formatTime(record, datefmt, None] = None) Format the time as an aware datetime.
usesTime() Check if the format uses the creation time of the record.

Attributes Documentation

default_msec_format = '%s,%03d'
default_time_format = '%Y-%m-%d %H:%M:%S'
use_local = True

Control whether local time is displayed instead of UTC.

Methods Documentation

converter()

timestamp[, tz] -> tz’s local time from POSIX timestamp.

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()

formatMessage(record)
formatStack(stack_info)

This method is provided as an extension point for specialized formatting of stack information.

The input data is a string as returned from a call to traceback.print_stack(), but with the last trailing newline removed.

The base implementation just returns the value passed in.

formatTime(record: logging.LogRecord, datefmt: Optional[str, None] = None) → str

Format the time as an aware datetime.

usesTime()

Check if the format uses the creation time of the record.