A tiny CLI logging library.
A lightweight, worry-free and colourful logging module for console applications which supports logging to STDOUT/STDERR, a JSON-like log file or a plain text file.
Built for intuitive usage and a neat and helpful look in the terminal.
Features
- Beautify objects and errors
- Print buffers as hex dump
- Tagging
- Show timestamps and the related source file
- Easily debug promises
- Simple timing support for messages, functions and promises
- Full color support
- Log to console (with support for
-v
/-q
arguments) or to a file
const mulog = ;mulog // How to set a file/change other configuration options.const µ = mulog; // Use mulog as a singleton; recommended.// const µ = new mulog(); // Use mulog as an object. // Basic usage;µ;µ;µ;µ;µ // µlog is also chainable ; // Advanced stuff to log;;µ; // hex dump, always printed on debug level // Tags (recommended syntax for tagging full files/modules) const µ = mulog; µ; // Nested tags and chained tag syntax µ; const doSomething = {a = 1; for let i = 0; i < 1000000000000 * Math; i++ a = a * i; ; return a};const doPromise = ; // Promises; // Timing (short)µ; // Timing (as instance)const t = µ;t;;t;
Default configuration
const mulog = ;const µ = mulog;
Available styles
Roadmap
- CLI to view JSON log files, with filtering
- proxy to different logging framework if used in a module (e.g.
global.µ = mulog.proxy("winston", winston)
, maybe even with autodetection if possible (?)) syslog integration(this needs to be done by the process manager, e.g. Docker or SystemD)