golang syntax log README.md (#1084)

* golang syntax log README.md

* golang syntax
pull/1090/head
拉小轰 4 years ago committed by GitHub
parent b22bc26a02
commit a928622f27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      log/README.md

@ -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…
Cancel
Save