goutils/logging/example_test.go

30 lines
580 B
Go
Raw Normal View History

2015-09-22 10:30:55 +00:00
package logging
2015-09-22 10:30:55 +00:00
var log = Init()
var olog = New("subsystem #42", LevelNotice)
2015-09-22 10:30:55 +00:00
func Example() {
log.Notice("Hello, world.")
log.Warning("this program is about to end")
olog.Print("now online")
2015-09-22 10:30:55 +00:00
Suppress("olog")
olog.Print("extraneous information")
2015-09-22 10:30:55 +00:00
Enable("olog")
olog.Print("relevant now")
2015-09-22 10:30:55 +00:00
SuppressAll()
log.Alert("screaming into the void")
olog.Critical("can anyone hear me?")
log.Enable()
log.Notice("i'm baaack")
log.Suppress()
log.Warning("but not for long")
2015-09-22 10:30:55 +00:00
EnableAll()
log.Notice("fare thee well")
olog.Print("all good journeys must come to an end")
}