From d9f7ee9b94df6779fcaef64edf3a480459e3ef16 Mon Sep 17 00:00:00 2001 From: Allen Li Date: Thu, 10 Aug 2023 14:39:59 -0700 Subject: [PATCH] log/slog: Reorder doc comment for level constants pkgsite and go doc print the doc comment *after* the code, resulting in: const ( LevelDebug Level = -4 ... ) Many paragraphs... Names for common levels. The "Names for common levels." feels out of place and confusing at the bottom. This is also consistent with the recommendation for the first sentence in doc comments to be the "summary". Change-Id: I8d337b24eb9bf8c83a7c6cca53e02605d3600e6b --- src/log/slog/level.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/log/slog/level.go b/src/log/slog/level.go index cd1213af64..c7b23a18f3 100644 --- a/src/log/slog/level.go +++ b/src/log/slog/level.go @@ -16,6 +16,8 @@ import ( // The higher the level, the more important or severe the event. type Level int +// Names for common levels. +// // Level numbers are inherently arbitrary, // but we picked them to satisfy three constraints. // Any system can map them to another numbering scheme if it wishes. @@ -38,8 +40,6 @@ type Level int // Level range. OpenTelemetry also has the names TRACE and FATAL, which slog // does not. But those OpenTelemetry levels can still be represented as slog // Levels by using the appropriate integers. -// -// Names for common levels. const ( LevelDebug Level = -4 LevelInfo Level = 0