Exemplo n.º 1
0
func ExampleNewMinLogger() {
	h := log.NewMinFormatter(log.SyncWriter(os.Stdout), log.PrefixOpt("PFX:"))
	l := log.NewLogger(syslog.LOG_WARNING, h)
	l.ERROR("fejl")
	// Output:
	// <3>PFX:fejl
}
Exemplo n.º 2
0
func ExampleApplyHandlerOptions() {
	h := log.NewMinFormatter(log.SyncWriter(os.Stdout), log.PrefixOpt("PFX:"))
	l := log.GetLogger("mylog")
	l.SetHandler(h)
	l.ERROR("fejl")
	l.ApplyHandlerOptions(log.FlagsOpt(log.Llevel | log.Lname))
	l.WARN("advarsel")
	// Output:
	// <3>PFX:fejl
	// <4>PFX: (mylog) advarsel
}