e2m2e.tools#
工具层:可视化、日志。
第 5 层,辅助层(ADR 0011 迁移,源:visualization/):核心库不 import
tools/。可视化可选依赖([viz] extra);日志为标准 logging + 键值对、
零新依赖。
仓库全貌与一条任务链的走读见 README 的仓库怎么读一节。
Submodules#
Classes#
把日志的 extra 键值对附加到消息尾部( |
Functions#
|
配置根 logger(级别 + 键值对 Formatter)。 |
Package Contents#
- class e2m2e.tools.KeyValueFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)#
Bases:
logging.Formatter把日志的 extra 键值对附加到消息尾部(
key=val)。- format(record: logging.LogRecord) str#
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.
- e2m2e.tools.configure_logging(level: str = 'WARNING', *, handler: logging.Handler | None = None, formatter: logging.Formatter | None = None) None#
配置根 logger(级别 + 键值对 Formatter)。
- Args:
level: 日志级别(DEBUG/INFO/WARNING/ERROR)。 handler: 输出 handler(缺省 StreamHandler)。 formatter: 自定义 Formatter(缺省 KeyValueFormatter)。