1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-10 00:29:01 +02:00
kratos/log/README.md
Tony Chen d78eb3ee4b
log: add level printer (#918)
* add level printer

* fix helper args

* fix test

* Update README.md
2021-05-17 16:34:28 +08:00

508 B

Log

Usage

Structured logging

Logger logger = log.MultiLogger(log.NewStdLogger(os.Stdout), syslog.NewLogger())

logger = log.With(logger,
    "service.name", "hellworld",
    "service.version", "v1.0.0",
    "ts", log.DefaultTimestamp,
    "caller", log.DefaultCaller,
)

logger.Log(log.LevelInfo, "key", "value")

Helper helper = log.NewHelper(logger)
helper.Log(log.LevelInfo, "key", "value")
helper.Info("info message")
helper.Infof("info %s", "message")
helper.Infow("key", "value")