Documentation
Logger Configuration
Configure logging levels and file output for MudPi's terminal and file logging.
Overview
When MudPi is executed, it displays output to the terminal based on the set log level. The Logger included with MudPi logs data to both the terminal (stdout) and a file. You can specify different log levels for both output streams.
Typically this output is already sent to a file or discarded if you are using a process monitor like Supervisor. However, it can be useful to log data to a file with a different verbosity than what is output in the terminal.
Configuration
{
"logging": {
"file_log_level": "debug",
"terminal_log_level": "debug",
"file": "mudpi.log"
}
}
Settings
| Option | Type | Required | Description |
|---|---|---|---|
| `file_log_level` | String | No | Log level for file output. Options: `debug`, `info`, `warn`, `critical`, `error`. |
| `terminal_log_level` | String | No | Log level for terminal output. Options: `debug`, `info`, `warn`, `critical`, `error`. |
| `file` | String | No | Full path including filename of the log file. If just a filename is provided, the file is stored in the MudPi root location (typically `/etc/mudpi/core`). |
Logger Usage
All log messages are written to the log file (if configured) using the format:
[%(asctime)s][%(name)s][%(levelname)s] %(message)s
Messages are printed unedited to stdout. The logging module allows you to select different logging levels for each handler.
Example Output
stdout (supports text color):
Initializing Logger... Complete
Log file (default mudpi.log):
[15:24:14][EVE][INFO] Initializing Logger... Complete
Tip
If debug is set to true in the configuration, all logging levels are automatically set to "debug" regardless of the logger configuration.
Warning
Ensure your log file has proper permissions if you experience write errors.