-
Notifications
You must be signed in to change notification settings - Fork 10
4x Log Levels
ccpaging edited this page Mar 7, 2018
·
1 revision
nxlog4go provides log levels as below:
type Level int
const (
FINEST Level = iota
FINE
DEBUG
TRACE
INFO
WARNING
ERROR
CRITICAL
_SILENT_ = 100
)
// Strings
var (
levelStrings = [...]string{"FNST", "FINE", "DEBG", "TRAC", "INFO", "WARN", "EROR", "CRIT", "OFFL"}
)
DEBUG
- WARNING
, are more useful.
ERROR
, may cause the program exited.
CRITICAL
, may crash the program.
_SILENT_
, used during configuration to turn in quiet mode. It is used in
loglog (internal logger) and set as default.
var log = l4g.New(l4g.DEBUG)
Setting the log level when build a logger.
log.SetLevel(l4g.WARNING)
Setting the output level for the logger. Any log's level which is lower then
WARNING
should be ignored.
SetXXX
functions in nxlog4go always return a point, so it is chainable. For
example:
var log = l4g.New(l4g.DEBUG).SetPrefix("example").SetPattern("[%T %D %Z] [%L] (%P:%s) %M\n")
See also: