format: a log can be made quiet, or full of errors - #35
Merged
Conversation
Adds level_mix to the log format, with realistic, quiet, errors and debug to choose from. It decides which severities appear, the way status_mix already decides which response codes do. The default is realistic, the mix these logs have always carried, so no existing file changes by a byte - checked against a binary built from main, six shapes by three seeds, eighteen of eighteen identical. Only the plain and json-lines shapes carry a severity, so asking for a mix beside one of the other four is refused by a message naming both settings rather than accepted in silence. The refusal fires on a real choice and not on the key arriving, because a window sends every setting it draws and a value equal to the default was never stated. The part that is not obvious from reading the declaration: the chosen set moves the MINIMUM. The shortest entry a shape can write has to leave room for the longest severity it might draw, and quiet draws only INFO, which is a shorter word than ERROR. Measured: plain 41 B against 40, json-lines 83 against 82. An arithmetic reading the whole vocabulary instead of the set in force would be wrong in the safe direction - a floor the format can beat, announced as if it could not - so neither the size guard nor the determinism guard would ever see it. longestLevel takes the options for that reason, and the guard asks for the announced minimum and for one byte below it rather than repeating the arithmetic. That closes the log format. The two settings still listed as missing have recorded reasons rather than no time behind them: an entry count disagrees with the exact size contract, and a start and end pair cannot work when the run does not know the entry count in advance. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
level_mixto the log format:realistic,quiet,errors,debug. It decides which severities appear, the waystatus_mixalready decides which response codes do.No existing file changes by a byte. The default is
realistic, which is the mix these logs have always carried, moved rather than rewritten so the same seed draws the same levels. Checked against a binary built frommain: six shapes by three seeds, eighteen of eighteen identical.The part that is not obvious from the declaration
The chosen set moves the minimum. The shortest entry a shape can write has to leave room for the longest severity it might draw, and
quietdraws onlyINFO, a shorter word thanERROR.realisticquietplainjson-linesAn arithmetic reading the whole vocabulary instead of the set in force would be wrong in the safe direction - a floor the format can beat, announced as if it could not. Neither the size guard nor the determinism guard would ever see that. So
longestLeveltakes the options, and the guard asks for the announced minimum and for one byte below it rather than repeating the arithmetic itself.Refusals
Only
plainandjson-linescarry a severity. Asking for a mix beside one of the other four is refused by a message naming both settings, rather than accepted in silence. The refusal fires on a real choice and not on the key arriving, because a window sends every setting it draws and a value equal to the default was never stated.What was checked
D11against amainbinary: 18 of 18 byte for byteNew guard:
TestTheLogSeverityMixIsDrawnAndSetsTheMinimum.This closes the log format. The two settings still listed as missing have recorded reasons rather than no time behind them: an entry count disagrees with the exact size contract, and a start and end pair cannot work when the run does not know the entry count in advance.
🤖 Generated with Claude Code