You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
471 B
Go
26 lines
471 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/fangdingjun/go-log"
|
|
"github.com/fangdingjun/go-log/formatters"
|
|
)
|
|
|
|
func main() {
|
|
log.Info("hello", 123)
|
|
log.Warn("hello", 123)
|
|
|
|
log.Default.Formatter = new(formatters.TextFormatter)
|
|
log.Infoln("hello", "world")
|
|
log.Warnln("hello", "world")
|
|
|
|
newLog := &log.Logger{
|
|
Level: log.INFO,
|
|
Formatter: new(formatters.JSONFormatter),
|
|
Out: os.Stdout,
|
|
}
|
|
newLog.Infof("hello %v", 123)
|
|
newLog.Warnf("hello %v", 123)
|
|
}
|