Module pysdrlib.logger
Functions
def new(name: str, level=None, ch=True, fh=True)-
Expand source code
def new(name: str, level = None, ch=True, fh=True): if level is None: level = logging.DEBUG logger = TraceLogger(f"pysdrlib.{name}") if LOGGING and ch: logger.addHandler(handler_console) if LOGGING and fh: logger.addHandler(handler_file) return logger
Classes
class TraceLogger (name, level=0)-
Expand source code
class TraceLogger(logging.Logger): def trace(self, msg, *args, **kwargs): if self.isEnabledFor(LOG_LEVEL_TRACE): self._log(LOG_LEVEL_TRACE, msg, args, **kwargs)Instances 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.
Initialize the logger with a name and an optional level.
Ancestors
- logging.Logger
- logging.Filterer
Methods
def trace(self, msg, *args, **kwargs)-
Expand source code
def trace(self, msg, *args, **kwargs): if self.isEnabledFor(LOG_LEVEL_TRACE): self._log(LOG_LEVEL_TRACE, msg, args, **kwargs)