Structured logging to systemd journal using native systemd libraries and JNA (Java Native Access).
Includes a log appender for timbre.
- automatically converts hash-maps to journal fields
- includes timbre output function that removes redundancy in log lines
[runejuhl/clj-journal "0.3.0"]
(require '[clj-journal.log :refer [jprint jsend]])
(jprint :error "Oh noes, an error!")
(jsend :emerg
"Even worse, we got ourselves an emergency!"
:some-informational-value 9000)
(def debug (jprint :debug))
(debug "This is a bit too verbose to be :info")
You can override clj-journal.util/level->syslog
if you want to use another way
of converting a keyword/string reprentation of the log level to an integer:
(binding [clj-journal.util/level->syslog (fn [_] 1)]
;; prints as ALERT instead of DEBUG
(jprint :debug "hello there"))
(timbre/merge-config!
{:appenders {:journal-appender (clj-journal.timbre/journal-appender)}})
(timbre/info "something happened!" {:asd 12
:leet 1337
:weird {:blegh "lollo"}})