3 The reference SLF (structured logging facade) implementation for Go

github.com godoc.org goreportcard.com posted by osklyar 3192 days ago  

The ventu-io/slf module provides for Go what SLF4J does for Java: a clean logging facade with no implementation and a factory that any code can use to pull a logger configured at the start of the application. And the ventu-io/slog provides the reference implementation of the structured logging facade (SLF) for Go. The following are the main characteristics of this implementation:

* log levels can be set per context, to the root context or to all context;

* defines generic Entry and EntryHandler interfaces enabling adding arbitrary handlers;

* permits concurrent (default) or sequential processing of each log entry by each entry handler;

* defines a basic entry handler for logging into text files or terminal, which is fully parametrisable via a template (via the standard Go text/template)

* defines a JSON log entry handler for formatting JSON into a consumer (io.Writer)

* delivers about 1mil log entries to log entry handlers on conventional hardware concurrently or sequentially

* handles locking of contexts and handlers

Register to comment or vote on this story