eventlog: add ATTENTION log level#55
Merged
Merged
Conversation
Decouple alert severity from the event-log (syslog) levels. alert.h now
defines alert_level_t {NOTICE, WARNING, ATTENTION, ERROR}, ordered by
ascending severity with ATTENTION sitting between WARNING and ERROR.
ac_level and alert_level_to_string are retyped to alert_level_t. The
climate_zone and power_rail sources map their states onto the new scale
(error/critical -> ERROR, otherwise WARNING). When an alert is written
into the system log, alert_set maps the alert level to an event level
(ATTENTION has no distinct event-log slot, so it logs as WARNING).
The eventlog levels and the log wire/flash format are unchanged. The
alert service already carries the level in a full byte, so the alert
wire format is unaffected.
ba7c7e3 to
3147c98
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a 9th level, LOG_ATTENTION (severity between ERR and INFO).
The level previously lived in a 3-bit field in both the on-flash log byte and the network wire byte (bit 6 = discontinuity), with all 8 syslog slots used. A 9th level needs a 4th bit, so the format byte is relaid out to DTTT_LLLL (level bits 0-3, ts-len bits 4-6, discontinuity bit 7). This is a wire-format break on the "log" service: old and new firmware/host will not interop until both are updated.
ATTENTION is appended as value 8 rather than inserted, so the existing 0-7 numbering stays aligned with POSIX <syslog.h> values used by the host decoders and with already-stored flash logs. Nothing orders levels numerically, so the severity-between-ERR-and-INFO meaning is purely documentation. The alert service is unaffected (it carries the level in a full byte).