- very high-performance
- developer friendly
- opinionated
- only writes to stdout, never to stderr
-
When stdout is connected to a terminal (tty), it writes beautiful output like so:
-
When stdout is not connected to a tty, then it writes optimized JSON in an array form:
To force the use of JSON output, you can do:
myapp | cat
or set an env var:
jlog_force_json=yes myapp
- Handles pointers, structs, slices/arrays, maps, and primitives
- Includes facilities for easily writing raw serialized data (string, byte) to stdout (and stderr if you want).
- The array format is optimized for performance and also developer friendliness since it is much less verbose.
[date, level, appname, pid, hostname, {customFields}, [...messages]]
Custom fields are used to filter the logs easily, for example if you want to filter the logs by request id:
[date, level, appname, pid, hostname, {requestId: ""}, [...messages]]
where requestId is a uuid for a particular request to an HTTP server.