๐ `log`
Print the last lines of a specified log file with enhanced, colorized formatting.
๐งช Usage
holocron log [options]
โ๏ธ Options
Option | Alias | Type | Default | Description |
---|---|---|---|---|
--level , -l | --log-level | string | all | Select the log level file to display. Options: all , error , warn , info , verbose , debug |
--output , -o | --max-lines | number | 20 | Number of last lines to show from the log file. |
๐ Log Files
The command reads logs from the directory configured at preferences.logs
in your config.
Log file names by level:
Level | Log File |
---|---|
all | log |
error | error.log |
warn | warn.log |
info | info.log |
verbose | verbose.log |
debug | debug.log |
๐ง Behavior
- Streams the selected log file line-by-line.
- Buffers only the last
maxLines
lines for display. - Parses each log line with expected format:
YYYY-MM-DD HH:mm:ss LEVEL: Message [tags]
- Outputs the following with colors:
- Timestamp in yellow brackets
- Log level in bold red
- Message in white
- Bracketed tags in magenta
- Line numbers in gray
- Lines not matching the pattern are printed with bracketed tags colored magenta and line number prepended.
๐ก Examples
# Show last 20 lines of all logs (default)holocron log
# Show last 50 lines of error logsholocron log --level error --output 50
# Using shorthand flagsholocron log -l warn -o 10
โ ๏ธ Notes
- The command expects the log files to exist at the configured logs directory.
- If the log file is missing or unreadable, the command will throw an error.
- Future improvements could add โfollowโ mode to tail logs in real-time.
๐งต Return Codes
0
โ Logs displayed successfully.1
โ Error occurred (e.g., file not found).