feat: fields and message expansion feature#1259
Merged
Conversation
5678965 to
d80c18f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1259 +/- ##
==========================================
+ Coverage 87.19% 87.88% +0.69%
==========================================
Files 66 67 +1
Lines 10873 11552 +679
==========================================
+ Hits 9481 10153 +672
- Misses 1392 1399 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d80c18f to
fe6ddad
Compare
fe6ddad to
bccb19b
Compare
This was referenced Jan 11, 2026
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.
Field and message expansion feature
This pull request introduces a new field expansion feature that provides better handling of multi-line content in log messages and field values. This is a simplified version of #320 without the heuristics-based expansion threshold levels.
Overview
The expansion feature gives you control over how
hlformats log records containing multi-line content such as stack traces, formatted JSON, or messages with line breaks. Instead of always displaying everything on a single line or always breaking content across multiple lines, you can now choose the behavior that best suits your needs.New
-x/--expansionOptionThe feature is controlled via the
-xor--expansioncommand-line option (orHL_EXPANSIONenvironment variable), which accepts four modes:Expansion Modes
never: All output is kept compact on a single line. Multi-line content is escaped using standard JSON escape sequences (\n,\t). Best for grep-friendly output or when you want maximum information density.inline: Multi-line content is preserved as-is, with actual line breaks in the output. Fields remain on the same conceptual line but may span multiple terminal lines. Useful when you want to see formatted content like JSON or stack traces in their natural form.auto(default): Intelligently expands fields and messages only when they contain multi-line content. Single-line logs stay compact, while multi-line content gets properly formatted with indentation. This provides the best of both worlds - compact output for simple logs and readable formatting for complex ones.always: Every field is expanded into multiple lines with clear indentation and visual structure. Provides maximum readability at the cost of vertical space.Examples
Single-line log (all modes produce similar output)
Multi-line message with
automode (default)Multi-line message with
nevermodeMulti-line message with
alwaysmodeConfiguration
The default expansion mode can be configured in your configuration file:
Use Cases
auto(recommended default): Best for general use, automatically adapting to content complexitynever: When piping to grep, processing with text tools, or when horizontal space is limitedinline: When you need to see formatted content (JSON, XML, stack traces) in their original formalways: When maximum readability is needed, such as during debugging sessions or presentationsBreaking Changes
The default expansion mode has changed from
inlinetoauto. This affects how multi-line content is displayed:inlinemode): Multi-line content was always displayed with actual line breaks preserved in the outputautomode): Multi-line content is now escaped and quoted by default, only expanding when it would improve readabilityTo preserve the exact previous behavior, set the expansion mode to
inline:hl -x inlineexport HL_EXPANSION=inlineFor most users, the new
automode provides better output that adapts to content complexity while maintaining compatibility with text processing tools.Closes #1170