From f40ddda89781aeb156f9b36bdb7d733c55b363c0 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Tue, 28 Sep 2021 14:33:09 +0100 Subject: Add some initial logging guidelines --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 7847377..a45b30d 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,21 @@ environment. Starting with GitLab 8.12, GitLab supports Git LFS authentication through SSH. +## Logging Guidelines + +In general, it should be possible to determine the structure, but not content, +of a gitlab-shell or gitlab-sshd session just from inspecting the logs. Some +guidelines: + +- We use [`gitlab.com/gitlab-org/labkit/log`](https://pkg.go.dev/gitlab.com/gitlab-org/labkit/log) + for logging functionality +- **Always** include a correlation ID +- Log messages should be invariant and unique. Include accessory information in + fields, using `log.WithField`, `log.WithFields`, or `log.WithError`. +- Log success cases as well as error cases +- Logging too much is better than not logging enough. If a message seems too + verbose, consider reducing the log level before removing the message. + ## Releasing See [PROCESS.md](./PROCESS.md) -- cgit v1.2.1