1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-07 23:02:12 +02:00

golang syntax log README.md (#1084)

* golang syntax log README.md

* golang syntax
This commit is contained in:
拉小轰 2021-06-20 21:10:40 +08:00 committed by GitHub
parent b22bc26a02
commit a928622f27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,8 @@
### Structured logging
```go
Logger logger = log.MultiLogger(log.NewStdLogger(os.Stdout), syslog.NewLogger())
var logger log.Logger = log.MultiLogger(log.NewStdLogger(os.Stdout), syslog.NewLogger())
logger = log.With(logger,
"service.name", "hellworld",
@ -16,9 +17,11 @@ logger = log.With(logger,
logger.Log(log.LevelInfo, "key", "value")
Helper helper = log.NewHelper(logger)
var helper log.Helper = log.NewHelper(logger)
helper.Log(log.LevelInfo, "key", "value")
helper.Info("info message")
helper.Infof("info %s", "message")
helper.Infow("key", "value")
```