A set of simple logging utilities written in go that are easily configurable and geared towards simple use cases.
logger := logging.NewLogger()
logging.LogLevel = logging.LOG_LEVEL_DEBUG
logging.Debug("foo")
logging.Debugf("debug: %s", "foo")
logging.Error(1)
logging.Errorf("error: %d", 1)
logging.Info("hello")
logging.Infof("info: %s", "hello")
logging.Warn(true)
logging.Warnf("warn: %t", true)Logger has the following properties. You can assign any os.File to redirect log output to that location.
DebugFile(defaults toos.Stderr)ErrorFile(defaults toos.Stderr)InfoFile(defaults toos.Stdout)WarnFile(defaults toos.Stderr)
Logger has the LogLevel property which is an int. The following convenient constants are exported:
LOG_LEVEL_NONEturns off all logging.LOG_LEVEL_ERRORallows Error logs.LOG_LEVEL_WARNallows Error and Warn logs.LOG_LEVEL_INFOallows Error, Warn, and Info logs.LOG_LEVEL_DEBUGallows Error, Warn, Info, and Debug logs.