Skip to content

๐Ÿ“œ `log`

Print the last lines of a specified log file with enhanced, colorized formatting.

๐Ÿงช Usage

Terminal window
holocron log [options]

โš™๏ธ Options

OptionAliasTypeDefaultDescription
--level, -l--log-levelstringallSelect the log level file to display. Options: all, error, warn, info, verbose, debug
--output, -o--max-linesnumber20Number 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:

LevelLog File
alllog
errorerror.log
warnwarn.log
infoinfo.log
verboseverbose.log
debugdebug.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

Terminal window
# Show last 20 lines of all logs (default)
holocron log
# Show last 50 lines of error logs
holocron log --level error --output 50
# Using shorthand flags
holocron 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).