Skip to content

Commit

Permalink
added new point in conventions.md to use provided helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
miampf committed Jan 31, 2024
1 parent ec7f294 commit f74a291
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dev-docs/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ Further we try to adhere to the following guidelines:

* Do not log potentially sensitive information, e.g. variables that contain keys, secrets or otherwise protected information.

* Create a text or JSON logger using the helper functions in the `logger` package. These create a `slog.Logger` with useful defaults.

Example:

```Go
log := logger.NewTextLogger(slog.LevelDebug)
log.Debug("A debug message")
```

* Start log messages in uppercase and end without a punctuation mark. Exclamation, question marks, or ellipsis may be used where appropriate.

Example:
Expand Down Expand Up @@ -57,7 +66,7 @@ Further we try to adhere to the following guidelines:
You should write

```Go
log..Info("Starting server", "addr", addr, "port", port)
log.Info("Starting server", "addr", addr, "port", port)
```

* Use log levels to configure how detailed the logs of you application should be.
Expand Down

0 comments on commit f74a291

Please sign in to comment.