ulog
is a simple and efficient level logging library for Go
The ulog
package can be added to a project with go get
.
go get cattlecloud.net/go/ulog@latest
log := ulog.New("my/component")
log.E.Fmt("the level is %s", "error")
log.W.Fmt("the level is %s", "warn")
log.I.Fmt("the level is %s", "info")
log.D.Fmt("the level is %s", "debug")
log.T.Fmt("the level is %s", "trace")
When running under systemd it is nice to not include the redundant timestamp
directly from the logging package (since journald will already insert one). To
exclude the timestamp simply set the ULOG_NOTIMESTAMP
environment variable
to true
.
e.g. in a systemd unit file
[Service]
# ...
Environment="ULOG_NOTIMESTAMP=true"
The cattlecloud.net/go/ulog
module is open source under the BSD-3-Clause license.