Exemplo n.º 1
0
func ExampleNamedLogger() {
	l := log.GetLogger("my/lib")
	h := log.NewFlxFormatter(log.SyncWriter(os.Stdout), "", log.Llevel|log.Lname)
	l.SetHandler(h)
	l2 := log.GetLogger("my/lib/module")

	l3 := l2.With("k", "v")

	l3.NOTICE("notice")
	// Output:
	// <5> (my/lib/module) notice k=v
}
Exemplo n.º 2
0
func ExamplePrintIgnores() {
	l := log.GetLogger("my/lib")
	h := log.NewFlxFormatter(log.SyncWriter(os.Stdout), "", log.Llevel|log.Lname)
	l.SetHandler(h)
	l.AutoColoring()
	l.SetLevel(syslog.LOG_ERROR)
	l.SetDefaultLevel(syslog.LOG_NOTICE, false)

	l.Print("ignoring level")
	// Output:
	// <5> (my/lib) ignoring level

}
Exemplo n.º 3
0
func ExampleSubLogger() {
	l := log.GetLogger("my/lib")
	h := log.NewFlxFormatter(log.SyncWriter(os.Stdout), "", log.Llevel|log.Lname)
	l.SetHandler(h)
	l.SetLevel(syslog.LOG_ERROR)

	l2 := l.With("key", "value")

	l3 := l2.With("more", "data")

	l3.ERROR("message")
	// Output:
	// <3> (my/lib) message more=data key=value

}