github.com/nikandfor/tlog@v0.21.5-0.20231108111739-3ef89426a96d/examples/loglevel/main.go (about)

     1  package main
     2  
     3  import "github.com/nikandfor/tlog"
     4  
     5  func main() {
     6  	tlog.DefaultLogger = tlog.New(tlog.NewConsoleWriter(tlog.Stderr, tlog.LdetFlags))
     7  
     8  	tlog.Printw("info", "", tlog.Info) // empty key is auto detected by value type
     9  	tlog.Printw("warning", "", tlog.Warn)
    10  	tlog.Printw("error", "", tlog.Error)
    11  	tlog.Printw("fatal", "", tlog.Fatal)
    12  	tlog.Printw("debug", "", tlog.Debug)
    13  	tlog.Printw("debug_3", "", tlog.LogLevel(-3))
    14  	tlog.Printw("level_6", "", tlog.LogLevel(6))
    15  
    16  	tlog.Printw("not a log level", tlog.KeyLogLevel, 2)
    17  }