summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2021-09-28 14:33:09 +0100
committerNick Thomas <nick@gitlab.com>2021-09-28 15:58:41 +0100
commitf40ddda89781aeb156f9b36bdb7d733c55b363c0 (patch)
tree0d70e3e65b0192089d6dd04b0ac8120341ba7de8
parent31079df31f4fd1f6fd6bc159d75b1febe5594a3a (diff)
downloadgitlab-shell-f40ddda89781aeb156f9b36bdb7d733c55b363c0.tar.gz
Add some initial logging guidelines499-log-me-more
-rw-r--r--README.md15
1 files changed, 15 insertions, 0 deletions
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)