nadzoring package

Subpackages

Submodules

nadzoring.__main__ module

nadzoring.cli module

Main CLI entry point.

nadzoring.cli.main() None[source]

Entrypoint to CLI Application.

nadzoring.logger module

Logging configuration module.

class nadzoring.logger.ColoredFormatter(fmt: str | None = None, datefmt: str | None = None, *, use_colors: bool = True, simple: bool = False)[source]

Bases: Formatter

Custom formatter with colors.

FORMATS: ClassVar[dict[int, str]] = {10: '\x1b[34;20m%(asctime)s | %(levelname)-8s | %(name)s | %(message)s\x1b[0m', 20: '\x1b[32;20m%(asctime)s | %(levelname)-8s | %(name)s | %(message)s\x1b[0m', 30: '\x1b[33;20m%(asctime)s | %(levelname)-8s | %(name)s | %(message)s\x1b[0m', 40: '\x1b[31;20m%(asctime)s | %(levelname)-8s | %(name)s | %(message)s\x1b[0m', 50: '\x1b[31;1m%(asctime)s | %(levelname)-8s | %(name)s | %(message)s\x1b[0m'}
SIMPLE_FORMATS: ClassVar[dict[int, str]] = {10: '\x1b[34;20m%(levelname)s: %(message)s\x1b[0m', 20: '\x1b[32;20m%(levelname)s: %(message)s\x1b[0m', 30: '\x1b[33;20m%(levelname)s: %(message)s\x1b[0m', 40: '\x1b[31;20m%(levelname)s: %(message)s\x1b[0m', 50: '\x1b[31;1m%(levelname)s: %(message)s\x1b[0m'}
__init__(fmt: str | None = None, datefmt: str | None = None, *, use_colors: bool = True, simple: bool = False) None[source]

Initialize the formatter with specified format strings.

Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.

Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting, str.format() ({}) formatting or string.Template formatting in your format string.

Changed in version 3.2: Added the style parameter.

blue: ClassVar[str] = '\x1b[34;20m'
bold_red: ClassVar[str] = '\x1b[31;1m'
format(record: LogRecord) str[source]

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.

format_str: ClassVar[str] = '%(asctime)s | %(levelname)-8s | %(name)s | %(message)s'
green: ClassVar[str] = '\x1b[32;20m'
grey: ClassVar[str] = '\x1b[38;20m'
quiet_format_str: ClassVar[str] = '%(message)s'
red: ClassVar[str] = '\x1b[31;20m'
reset: ClassVar[str] = '\x1b[0m'
simple_format_str: ClassVar[str] = '%(levelname)s: %(message)s'
yellow: ClassVar[str] = '\x1b[33;20m'
nadzoring.logger.get_logger(name: str | None = None) Logger[source]

Get child logger.

Parameters:

name – Module name

Returns:

Logger instance

nadzoring.logger.setup_cli_logging(*, verbose: bool = False, quiet: bool = False, no_color: bool = False) None[source]

Setup logging for CLI mode.

Parameters:
  • verbose – Verbose output (DEBUG level)

  • quiet – Quiet mode (only results, no logs)

  • no_color – Disable colored output

Module contents