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:
parent
b22bc26a02
commit
a928622f27
@ -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")
|
||||
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user