# README
logger - A simple logging layer on top of seelog
Implements multiple log channels to a single rotated log file. Log levels are considered a simple hierarchy with each channel having a single limit, below which logs to that channel are skipped.
The makeloggerinterface
is a program to generate the interface.go
file to simplify its maintenance.
# Functions
global logging message.
global logging formatted message.
flush all channels and let log message goes to standard out.
flush all channels.
Set up the logging system.
ListLevels - return log level info in json format it's not lock protected, because it should be low frequency to list log levels.
Open a new logging channel with a specified tag.
global logging message + panic.
global logging formatted message + panic.
conditional panic.
UpdateTagLogLevel - update log level for specific tag.
# Constants
the initial level for unknown tags.
the tagname reserved to set the default level for unknown tags.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
initial configuration for the logger
example of use (with structure tags for config file parsing) type AppConfiguration struct { … Logging logger.Configuration `libucl:"logging" hcl:"logging" json:"logging"` … }
err := logger.Initialise(conf.Logging) if nil != err { // if failed then display message and exit exitwithstatus.Message("logger error: %s", err) } defer logger.Finalise()
example of ucl/hcl configuration section logging { directory = "/var/lib/app/log" file = "app.log" size = 1048576 count = 50 #console = true # to duplicate messages to console (default false) levels { DEFAULT = "info" system = "error" main = "warn" } }.
The logging channel structure example of use
var log *logger.L log := logger.New("sometag")
log.Debugf("value: %d", value).
Level - log level info.
LogLevels - log levels.