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
This commit is contained in:
Allen Li 2023-08-10 14:39:59 -07:00
parent 162469b3cf
commit d9f7ee9b94
1 changed files with 2 additions and 2 deletions

View 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