]> Cypherpunks.ru repositories - gostls13.git/commitdiff
log/slog: Reorder doc comment for level constants
authorAllen Li <ayatane@google.com>
Thu, 10 Aug 2023 22:01:32 +0000 (22:01 +0000)
committerJonathan Amsterdam <jba@google.com>
Mon, 30 Oct 2023 17:34:43 +0000 (17:34 +0000)
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 <alan@alandonovan.net>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
src/log/slog/level.go

index 351d4fa1594aff4fa34e6e95050180a0947447a9..7cddf4cfba5ca27fe036114e12aa7c69f92ee0f2 100644 (file)
@@ -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