tlc.core.objects.tables.system_tables.log_table#

A table populated by the logging module

Module Contents#

Classes#

Class

Description

LogTableHandler

Forwards log messages to the LogTable instance.

LogTable

A table populated by the logging module, targeted for in-memory-only usage.

API#

class tlc.core.objects.tables.system_tables.log_table.LogTableHandler(callback: Callable[[logging.LogRecord], None])#

Bases: logging.Handler

Forwards log messages to the LogTable instance.

Initializes the instance - basically setting the formatter to None and the filter list to empty.

emit(record: logging.LogRecord) None#
set_formatter(formatter: logging.Formatter) None#
class tlc.core.objects.tables.system_tables.log_table.LogTable(url: tlc.core.url.Url | None = None, init_parameters: Any = None, rotation_size: int | None = None, loglevel: int | None = None, exclude: list[str] | None = None)#

Bases: tlc.core.objects.table.Table

A table populated by the logging module, targeted for in-memory-only usage.

A LogTable is a special Table that is populated by the logging system. It is not strictly immutable since it is continuously populated by the logging system. The LogTable will report fully defined when the schema is defined (like the base class) but will still evolve as logging events write new rows and bumps the row_count.

Mostly the LogTable will be accessed through the singleton instance LogTable.instance(). This instance is created automatically when the module is loaded. The instance can be accessed by the URL api://LogTable.

The LogTable global instance will filter some log messages that are generated by the object service.

Parameters:
  • url – The URL of the table.

  • init_parameters – The table initialization parameters.

  • rotation_size – The number of rows to keep in memory before rotating the rows.

  • loglevel – The initial logging level to use for the LogTable. Note that this may be changed later by external logging configuration.

  • exclude – A list of substrings that if found in log records should filter out the log record.

log_table_instance: tlc.core.objects.tables.system_tables.log_table.LogTable | None = None#
static instance() tlc.core.objects.tables.system_tables.log_table.LogTable#

Returns the singleton LogTable object

handle_log(record: logging.LogRecord) None#
write_to_url(force: bool = False) tlc.core.url.Url#

LogTable is an in-memory table not meant to be written to a URL.

Override the base class to make it an no-op.

property counter: int#