dissect.target.helpers.logging¶
Module Contents¶
Classes¶
Instances of the Logger class represent a single logging channel. A |
|
An adapter for loggers which makes it easier to specify contextual |
Functions¶
Get a logger with |
Attributes¶
- dissect.target.helpers.logging.TRACE_LEVEL = 5¶
- class dissect.target.helpers.logging.TraceLogger(name, level=NOTSET)¶
Bases:
logging.LoggerInstances of the Logger class represent a single logging channel. A “logging channel” indicates an area of an application. Exactly how an “area” is defined is up to the application developer. Since an application can have any number of areas, logging channels are identified by a unique string. Application areas can be nested (e.g. an area of “input processing” might include sub-areas “read CSV files”, “read XLS files” and “read Gnumeric files”). To cater for this natural nesting, channel names are organized into a namespace hierarchy where levels are separated by periods, much like the Java or Python package namespace. So in the instance given above, channel names might be “input” for the upper level, and “input.csv”, “input.xls” and “input.gnu” for the sub-levels. There is no arbitrary limit to the depth of nesting.
- trace(msg: Any, *args: Any, **kwargs: Any) None¶
- dissect.target.helpers.logging.get_logger(name: str | None = None) TraceLogger¶
Get a logger with
TRACEsupport.
- class dissect.target.helpers.logging.TargetLogAdapter(logger, extra=None)¶
Bases:
logging.LoggerAdapterAn adapter for loggers which makes it easier to specify contextual information in logging output.
- process(msg: str, kwargs: dict[str, Any]) tuple[str, dict[str, Any]]¶
Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.
Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.
- trace(msg: Any, *args, **kwargs) None¶
Delegate a trace call to the underlying logger.