Repository navigation
Preserve bracket fields and message when SquareBracketColumnizer applies a time offset - #754
Open
EnesKartal wants to merge 2 commits into
Open
EnesKartal wants to merge 2 commits into
EnesKartal wants to merge 2 commits into
Conversation
…ies a time offset
Hirogen
requested changes
Nov 20, 2026
Hirogen
left a comment
Member
There was a problem hiding this comment.
Thanks for picking this up! The fix looks right. Using newDate.Length for the timestamp end position is actually more robust than endPos, and the tests cover exactly what #713 asked for (zero, positive and negative offsets, midnight rollover both ways, reset to 0, and the log line itself left unchanged).
Two small requests before I merge:
- Nested-bracket case under an offset. Could you add one test that applies a nonzero offset to a line with a nested field, e.g.
2022-03-21 11:34:34.505[INFO][ProgramName/MethodName[41]]Message, and checks that[ProgramName/MethodName[41]]stays one column? That's the #460 behavior, and it's the one column shape the new tests don't cover yet. - Issue reference comment. Please put a one-line
// Issue #713: ...comment above the new tests, like the existing #460 test has.
Optional: the Select(c => c.FullValue.ToString()) assertion appears six times, so a small helper would tidy it up. Inline is fine too.
Thanks again!
Author
|
Thanks for the review! Addressed in d541416:
|
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.
Fixes #713
Root Cause
In
SquareBracketColumnizer.SplitLine, when_timeOffset != 0, only the reformatted timestamp string (newDate) was passed toSquareSplit, discarding the remainder of the log line starting atendPos. As a result, all bracketed fields and the message column were returned empty.Fix
newDatewithtemp.Span[endPos..]before passing the shifted line toSquareSplit(usingnewDate.Lengthas the timestamp end position).ILogLineMemory.FullLineunmodified.Tests
SplitLine_TimeOffset_PreservesBracketFieldsAndMessagecovering zero, positive (+123 ms), negative (-506 ms), and reset-to-zero offsets.SplitLine_TimeOffsetCrossesMidnight_ShiftsDateAndPreservesRemainingColumnscovering forward and backward date rollovers.SquareBracketColumnizerTestandMarkerColumnizerSnapshotTests(12 passed, 0 failed) and the fullLogExpert.Testssuite (1032 passed, 7 skipped, 0 failed).