mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-07 14:32:17 -04:00
updated conventions.md to more idiomatic suggestion
This commit is contained in:
parent
081d357e58
commit
8a246a07b4
1 changed files with 2 additions and 2 deletions
|
@ -40,12 +40,12 @@ Further we try to adhere to the following guidelines:
|
||||||
log.Error("A critical error occurred!")
|
log.Error("A critical error occurred!")
|
||||||
```
|
```
|
||||||
|
|
||||||
* Use the `With()` method to add structured context to your log messages. The context tags should be easily searchable to allow for easy log filtering. Try to keep consistent tag naming!
|
* Use additional arguments to add structured context to your log messages. The context tags should be easily searchable to allow for easy log filtering. Try to keep consistent tag naming!
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```Go
|
```Go
|
||||||
log.With(slog.Any("error" someError), slog.String("ip", "192.0.2.1")).Error("Connecting to IP failed")
|
log.Error("Connecting to IP failed", "error", someError, "ip", "192.0.2.1")
|
||||||
```
|
```
|
||||||
|
|
||||||
* Log messages may use format strings to produce human readable messages. However, the information should also be present as structured context fields if it might be valuable for debugging purposes. So, instead of writing
|
* Log messages may use format strings to produce human readable messages. However, the information should also be present as structured context fields if it might be valuable for debugging purposes. So, instead of writing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue