core.resharding.nvshmem_copy_service.logger#
Per-PE Logger with colored console and file output.
Similar to the C++ Logger implementation, provides:
Per-PE colored console output
Per-PE file logging
Support for TRACE, DEBUG, INFO, SUMMARY, WARN, ERROR levels
Module Contents#
Classes#
Custom formatter that adds color codes for console output. |
|
Per-PE logger with colored console and file output. |
API#
- class core.resharding.nvshmem_copy_service.logger.ColoredFormatter(fmt: str, pe_id: int, use_color: bool = True)#
Bases:
logging.FormatterCustom formatter that adds color codes for console output.
Initialization
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, :meth:
str.format({}) formatting or- Class:
string.Templateformatting in your format string.
.. versionchanged:: 3.2 Added the
styleparameter.- formatTime(record, datefmt=None)#
- format(record)#
- class core.resharding.nvshmem_copy_service.logger.PELogger#
Per-PE logger with colored console and file output.
- _logger: Optional[logging.Logger]#
None
- _pe_id: int#
None
- _level: int#
None
- classmethod init(pe_id: int, level: str = 'INFO', logs_dir: str = 'logs')#
Initialize logger for this PE.
- Parameters:
pe_id – Process element ID
level – Log level (TRACE, DEBUG, INFO, WARN, ERROR)
logs_dir – Directory for log files
- classmethod set_level(level: str)#
Set the logging level.
- classmethod trace(msg: str)#
Log at TRACE level (most detailed).
- classmethod debug(msg: str)#
Log at DEBUG level.
- classmethod info(msg: str)#
Log at INFO level.
- classmethod summary(msg: str)#
Log summary information (INFO level with [SUMMARY] prefix).
- classmethod warn(msg: str)#
Log at WARNING level.
- classmethod warning(msg: str)#
Log at WARNING level (alias for warn).
- classmethod error(msg: str)#
Log at ERROR level.
- classmethod critical(msg: str)#
Log at CRITICAL level.
- classmethod shutdown()#
Shutdown the logger and flush all handlers.