Expand description
Two sinks, two formats — port of log_config.py.
Console (stdout) is human-readable: INFO and RUN bare, [!] for
warnings, [ERROR] , [CRITICAL] , [debug] .
The file logs/xil_v2_<date>_<host>.log under the workspace root is one
record per line: <iso ts>|<LEVEL>|<host>|<stage>|<message>. Multi-line
messages get the prefix on every physical line; whitespace-only records
are dropped from the file. The message may itself contain |.
Python opens the file handler at configure time, which creates an empty
log file even when nothing is logged. init does the same, so the set
of files a command leaves behind matches.
Structs§
- Logger 🔒
Enums§
- Level
- Severity, ordered like Python’s numeric levels (
RUN= 25 sits between INFO and WARNING). - Sink
- Which sinks a record goes to. Mirrors
extra={"console": False}/extra={"file": False}in the Python.
Statics§
- LOGGER 🔒
Functions§
- critical
- debug
- error
- host
- Short, filename-safe hostname: first label, non
[A-Za-z0-9._-]→-. - info
- init
- Install the logger for a command.
stageis what Python derives fromargv[0]("use","parse", …). Safe to call more than once; only the first call opens the file. Createslogs/and the (possibly empty) file. - log
- Emit one record. Callers normally use the level helpers below.
- log_
path - Path of today’s log file for this host under
<workspace>/logs/. - run
- set_
threshold - Raise or lower the console/file threshold (Python
configure_logging(level)). - warning