-
Notifications
You must be signed in to change notification settings - Fork 5
Logging levels
Michael Kenney edited this page Aug 13, 2018
·
1 revision
bdlm/log
has six logging levels: Debug, Info, Warning, Error, Fatal and Panic.
log.Debug("Useful debugging information.")
log.Info("Something noteworthy happened!")
log.Warn("You should probably take a look at this.")
log.Error("Something failed but I'm not quitting.")
// Calls os.Exit(1) after logging
log.Fatal("Bye.")
// Calls panic() after logging
log.Panic("I'm bailing.")
You can set the logging level on a Logger
, then it will only log entries with that severity or anything above it:
// Will log anything that is info or above (warn, error, fatal, panic). Default.
log.SetLevel(log.InfoLevel)
It may be useful to set log.Level = log.DebugLevel
in a debug or verbose environment if your application has that.
Which one will reach the other side of the river: The one who dreams of a raft, or the one that hitchhikes to the next bridge?