severity(): Notice band is unreachable — sevNotice(5) is dead code #2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
severity()insyslog.gomapsslog.Levelto RFC 5424 severities,but no input ever produces
sevNotice(5). The INFO band maps toinfo(6)and the WARN band towarning(4); Notice is skippedentirely.
sevNoticeis a defined constant with no code path.Where
syslog.go,func severity(l slog.Level) int:Nothing returns
sevNotice.Impact
An application that defines the conventional Notice level between
Info(0) and Warn(4) — i.e.
slog.LevelInfo + 2— has its recordsframed as
info(6)in thejournal/syslogformats, losing theNotice distinction. There is currently no way to emit a
Notice-severity line even though RFC 5424 (and hslog's own constant)
defines one. The mapping is asymmetric: levels above Error already
map upward to crit/alert/emerg, but the low side has a hole at Notice.
Proposal
slog.LevelInfo < l < slog.LevelWarn, returnsevNotice(5); keepexact
slog.LevelInfo->info(6).hslog.LevelNotice = slog.LevelInfo + 2socallers don't hardcode the offset, mirroring how levels above
Error are already documented.
record currently prints as
INFO+2rather thanNOTICE.Context
Surfaced while wiring log levels into the dcbop container-hardening
tooling (stc-dc-workflow): we want the syslog order
error/warning/notice/info/debug, and hit the Notice gap.