From: Allen Li Date: Thu, 10 Aug 2023 22:01:32 +0000 (+0000) Subject: log/slog: Reorder doc comment for level constants X-Git-Tag: go1.22rc1~487 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1e95fc7ffe1faa0e329b32015532d9fa58a1a6c9;p=gostls13.git 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: I656e85e27d2a4b23eaba5f2c1f4f811a88848c83 GitHub-Last-Rev: d9f7ee9b94df6779fcaef64edf3a480459e3ef16 GitHub-Pull-Request: golang/go#61943 Reviewed-on: https://go-review.googlesource.com/c/go/+/518537 Reviewed-by: Alan Donovan Reviewed-by: Cherry Mui Reviewed-by: Jonathan Amsterdam TryBot-Result: Gopher Robot Run-TryBot: qiulaidongfeng <2645477756@qq.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> --- diff --git a/src/log/slog/level.go b/src/log/slog/level.go index 351d4fa159..7cddf4cfba 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