nadzoring package¶
Subpackages¶
Submodules¶
nadzoring.__main__ module¶
nadzoring.cli module¶
- nadzoring.cli.colorize_result(result: dict[str, Any]) dict[str, Any][source]¶
Add color coding to results
nadzoring.logger module¶
- class nadzoring.logger.ColoredFormatter(fmt: str | None = None, datefmt: str | None = None, *, use_colors: bool = True, simple: bool = False)[source]¶
Bases:
FormatterCustom 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 orstring.Templateformatting in your format string.Changed in version 3.2: Added the
styleparameter.
- 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'¶