Compact.md
PuduLangLog.Formatting.Compact
type: module path: "@root/src/PuduLangLog/Formatting/Compact.pudu" fidelity: Active grammar: "[[grammar/pudu]]" depth_score: 0.6 depth_status: MEDIUM tags: [module, formatter] aliases: [PuduLangLog.Formatting.Compact]
Purpose
[[domain/Formatting|Formatters]] writing each event as one line of compact JSON with @-prefixed reserved members: compact keeps the template, rendered writes the message and the template's identifier.
Interface
Signatures
export fn compact() -> Log.Formatter
export fn rendered() -> Log.FormatterLinkage
- Requires: [[src/PuduLangLog]], [[src/PuduLangLog/Domain/Dates]], [[src/PuduLangLog/Domain/Display]], [[src/PuduLangLog/Domain/EventId]], [[src/PuduLangLog/Domain/Json]], [[src/PuduLangLog/Domain/Levels]].
- Consumed by: [[src/PuduLangLog/Sinks/Http]], package users, and settings.
Algorithm
@tis the UTC timestamp with seven fraction digits andZ.compactwrites@mtand, when holes have formats,@r: each formatted hole rendered in template order.renderedwrites@mand@i, eight hexadecimal digits of [[src/PuduLangLog/Domain/EventId]].@lappears unless the level isInformation;@x,@tr, and@spwhen present.- Properties follow at the top level; a name starting with
@is written with a second@so it never collides with a reserved member. Structures carry$type.
Negative Logic (Prohibited Paths)
- No property can overwrite a reserved
@member.
Edge Cases
- An
Informationevent without properties is only@tand@mt.
Depth
DEPTH 0.6 (MEDIUM). Tested by test/PuduLangLog/Formatting/FormattingTest.
Grill Log
- Q: Why leave out the
Informationlevel? A: It is the most common level; omitting it keeps the common line short, and readers treat a missing@lasInformation. _Rejected:_ always writing it.
Referenced by
[[src/PuduLangLog/_MOC]] · [[src/PuduLangLog/Domain/EventId]] · [[src/PuduLangLog/Settings/Registry]] · [[src/PuduLangLog/Sinks/Http]] · [[subsystems/Formatting]]
