Debugging shows file/lineno.

This commit is contained in:
Kyle Isom
2015-09-22 15:14:36 -07:00
parent ea689c7e97
commit b933a136f3
3 changed files with 64 additions and 13 deletions

View File

@@ -8,13 +8,17 @@ import (
)
var log = logging.Init()
var olog = logging.New("subsystem #42", logging.LevelNotice)
var olog, _ = logging.New("subsystem #42", logging.LevelNotice)
func main() {
exampleNewWriters()
log.Notice("Hello, world.")
log.Warning("this program is about to end")
log.SetLevel(logging.LevelDebug)
log.Debug("hello world")
log.SetLevel(logging.LevelNotice)
olog.Print("now online")
logging.Suppress("olog")
olog.Print("extraneous information")
@@ -41,7 +45,7 @@ func exampleNewWriters() {
o := testio.NewBufCloser(nil)
e := testio.NewBufCloser(nil)
wlog := logging.NewFromWriters("writers", logging.DefaultLevel, o, e)
wlog, _ := logging.NewFromWriters("writers", logging.DefaultLevel, o, e)
wlog.Notice("hello, world")
wlog.Notice("some more things happening")
wlog.Warning("something suspicious has happened")