Log
caution
This section of the document is under verification.
- The log is only initialized once in the process.
- Log configuration parameters are directly written in global parameters.
Overview
Name | Main Initialization Parameters | Remarks |
---|---|---|
Logger | Logger::path , Logger::maxBytes , Logger::backupCount , Logger::flush_every , Logger::pattern | By default, it exists in the interpreter's environment initialization (Interpreter::env) and is initialized once during interpreter initialization. |
Logger
Implements logging functionality (including console output and file output).
By default, this backend uses console output. If the Logger::path
parameter is configured, it will also output to the log file corresponding to path
.
Initialization
Parameters
- Logger::path - Specifies the log file path. If no path is specified, the log will be output to the console by default. If a path is specified, the log will be output to both the log file and the console.
- Logger::maxBytes - Specifies the maximum storage space for each log file, in bytes. This parameter only takes effect when a log file path is specified. Valid values are 1-1073741824 (1G).
- Logger::backupCount - Specifies the maximum number of log files to store, used in conjunction with the
Logger::maxBytes
parameter. Valid values are 0-1024. When the value is 0, it means that only the specified file is stored in a circular manner without backup. When the value is 1, the stored files are: log.txt, log.1.txt, with one backup. - Logger::pattern - Sets the print mode of the logger.
- The default value in debug mode is
[%l][%m/%d %H:%M:%S][%s:%#%!]: %v
. - The default value in release mode is
[%l][%m/%d %H:%M:%S][%s:%#]: %v
.
- The default value in debug mode is
- Logger::flush_every - Specifies the frequency at which the log is flushed to the file, in seconds. The default value is 5. Setting it to 0 means that every log will be flushed.
Example
```toml "Logger::path" = "./torchpipe.log" # Optional parameter, specifies the log file path. If not set, the log will be output to the console by default. "Logger::maxBytes" = 1048576 # # Optional parameter, enables circular storage when set, specifies the maximum storage space for a single log file. Default value: infinity. Valid values are 1-1073741824 (1G). "Logger::backupCount" = 20 # Optional parameter, used in conjunction with the `Logger::maxBytes` parameter, specifies the maximum number of log files to store. Valid values are 0-1024. ```