/log

A structured logger for Go, based on zap.

Primary LanguageGoMIT LicenseMIT

log

A structured logger for Go, based on zap. Migrated from golib.

test codecov Go Report Card release license

Quick Start

opts := log.Newoptions()
errs := opts.Validate()
if len(errs) > 0 {
	// handle errors
	return
}

log.Configure(opts)
defer func() {
    _ = log.Close()
}()

log.Debug("debug message")
log.Info("info message")
log.Warn("warn message")
log.Error("error message")

log.Debugf("%s message", "debug")
log.Infof("%s message", "info")
log.Warnf("%s message", "warn")
log.Errorf("%s message", "error")

log.Debugt("debug message", log.String("key1", "value1"))
log.Infot("info message", log.Int32("key2", 10))
log.Warnt("warn message", log.Bool("key3", false))
log.Errort("error message", log.Any("key4", "any"))

Documentation

You can find the docs at go docs.

🔋 JetBrains OS licenses

log had been being developed with GoLand under the free JetBrains Open Source license(s) granted by JetBrains s.r.o., hence I would like to express my thanks here.

JetBrains Logo (Main) logo.