package main import ( "fmt" "udico.de/util/log" ) var logger = log.Logger("MyLogger").SetLevel(log.TRACE).SetAutotrace(log.TRACE) func anotherFunc() { log.NOTICE.WithStackAs(log.INFO).Msg("Let's dump a stack trace!") } func aFunc() { log.INFO.Msg("in aFunc") anotherFunc() } func main() { log.DefaultLogger.SetLevel(log.DEBUG).SetAutotrace(log.TRACE) // dump logger config: log.INFO.Explain() log.WARN.To(logger).Msg("Now doing things :)") log.INFO.Msg("hallo %v", "bla") log.TRACE.To(logger).Arg("a", "b").If(func(msg log.Fn) { msg("Calculating important things ...") msg("hi!") }) aFunc() log.ERROR.To(logger).WithStackAs(log.ERROR).Msg("Bad things happened :(") log.NOTICE.Msg("I'm done!") log.INFO.Err(fmt.Errorf("oh, an error!")).Msg("what's this?") } /* log.INFO.Msg("...", a) log.INFO.Ctx(lo).With("field", "").Msg(...) log.TRACE.If(func(log logfn) { // some expensive code goes here log("something") }) */