gravelamps.core.gravelog

Functions controlling the use, configuration, and generation of loggers for use in Gravelamps. Configuration of the logging is maintained in the gravelog.json file.

class gravelamps.core.gravelog.GraveJSONFormatter(*, fmt_keys: dict[str, str] | None = None)

Bases: Formatter

Modified logging format for JSON-based logging

Methods

converter

format(record)

Format the specified record as text.

formatException(ei)

Format and return the specified exception information as a string.

formatStack(stack_info)

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

formatTime(record[, datefmt])

Return the creation time of the specified LogRecord as formatted text.

usesTime()

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

formatMessage

format(record: 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.

gravelamps.core.gravelog.setup_logging(config_fp=None, outdir=None, logging_level=None)

Generates the logger with the configuration specified in the package’s configuration tools.

Parameters:
config_fp: str, optional

Path to config file if wishing to overwrite.

outdir: str, optional

Path to output directory to place logging file. Default behaviour is in running directory.

logging_level: str, optional

Desired logging level for screen output. Default is INFO.