This is a extension of zap
which implement zapcore.Encoder
and zapcore.WriteSyncer
of systemd-journal.
Check ./example/example.go for usage.
-
The default logger setup (
zapjournal.New()
andzapjournal.NewDebug()
) produce a named logger with the executable file name get fromos.Executable()
. This behavior is different from zap. -
The key passed to zap will be convert to UPPERCASE. And all
_
. As journald seems refuse to record such fields. -
journalctl
will not show any custom fields by default. And it not support any format customization option to display custom fields. But it has an option to output log as json which can be pass tojq
, Then that be formatted to a human readable output.Check journalfmt as well.