mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-13 09:53:10 -06:00
Update CODE_STYLE.md
This commit is contained in:
parent
ad23cb1024
commit
9f98522c2c
|
|
@ -54,8 +54,8 @@ issue number should be added to the comment, e.g. `// TODO(#324): ...`
|
||||||
|
|
||||||
## Logging
|
## Logging
|
||||||
|
|
||||||
We prefer to log with static log messages and include any dynamic information
|
We generally prefer to log with static log messages and include any dynamic
|
||||||
in fields.
|
information in fields.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
logger := util.GetLogger(ctx)
|
logger := util.GetLogger(ctx)
|
||||||
|
|
@ -70,6 +70,10 @@ logger.WithFields(logrus.Fields{
|
||||||
}).Info("Finished processing keys")
|
}).Info("Finished processing keys")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This is useful when logging to systems that natively understand log fields, as
|
||||||
|
it allows people to search and process the fields without having to parse the
|
||||||
|
log message.
|
||||||
|
|
||||||
|
|
||||||
## Visual Studio Code
|
## Visual Studio Code
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue