From f74a2914b97e85bed20b72bd4620c28cf677efb0 Mon Sep 17 00:00:00 2001 From: miampf Date: Wed, 31 Jan 2024 16:12:01 +0100 Subject: [PATCH] added new point in conventions.md to use provided helper functions --- dev-docs/conventions.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dev-docs/conventions.md b/dev-docs/conventions.md index 1e62433bea..02b08e1dbd 100644 --- a/dev-docs/conventions.md +++ b/dev-docs/conventions.md @@ -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: @@ -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.