Skip to content

madmaxieee/loglit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loglit

Loglit is a powerful CLI tool designed to make log analysis easier by adding syntax highlighting to your logs in the terminal. It supports a wide range of built-in patterns and allows for custom regex highlighting.

demo

Features

  • Syntax Highlighting: Automatically highlights common log elements:
    • Log Levels: ERROR, WARN, INFO, DEBUG, TRACE, FATAL, etc.
    • Dates & Times: RFC3339, YYYY-MM-DD, MM/DD, durations (e.g., 10s, 50ms).
    • Numbers: Integers, floats, hex, binary, octal.
    • Network: IPv4, IPv6, MAC addresses, URLs.
    • Identifiers: UUIDs, MD5/SHA hashes.
    • Code Elements: Boolean, null, strings, paths.
  • Input Flexibility: Reads from standard input (stdin) or files.
  • Custom Patterns: Highlight specific terms or patterns using regex arguments.
  • Output Handling: Writes highlighted output to stderr (preserving stdout for piping if needed) and intelligently handles terminal detection.

Installation

go install github.com/madmaxieee/loglit@latest

Usage

Basic Usage

It writes highlighted output to stderr and raw output to stdout. This means you can "peek" highlighted logs in your terminal while simultaneously piping the clean raw logs to a file or another tool:

tail -f app.log | loglit > clean_logs.txt

Read directly from a file:

loglit -i application.log

Custom Highlighting

You can provide additional regex patterns as arguments to highlight them specifically (defaults to a bold/highlighted style):

# Highlight "connection timeout" and specific error codes
loglit "connection timeout" "ERR-\d+" -i app.log

Acknowledgments

About

syntax highlighting for any log stream/file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors