From 9f98522c2c15a104199e7db13f54a5787007b0f5 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 21 Nov 2017 18:15:47 +0000 Subject: [PATCH] Update CODE_STYLE.md --- CODE_STYLE.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CODE_STYLE.md b/CODE_STYLE.md index 20f97436f..e8208172c 100644 --- a/CODE_STYLE.md +++ b/CODE_STYLE.md @@ -54,8 +54,8 @@ issue number should be added to the comment, e.g. `// TODO(#324): ...` ## Logging -We prefer to log with static log messages and include any dynamic information -in fields. +We generally prefer to log with static log messages and include any dynamic +information in fields. ```golang logger := util.GetLogger(ctx) @@ -70,6 +70,10 @@ logger.WithFields(logrus.Fields{ }).Info("Finished processing keys") ``` +This is useful when logging to systems that natively understand log fields, as +it allows people to search and process the fields without having to parse the +log message. + ## Visual Studio Code