Repository navigation
Support custom pretty placeholders - #386
Merged
Merged
Conversation
Callbacks may return numbers as well as strings. IPrettyLogStyles now accepts any key so custom tokens can be styled, so a misspelled built-in key is reported at runtime instead (UNKNOWN_PRETTY_STYLE, with a did-you-mean; throws under strictConfig). KNOWN_PRETTY_PLACEHOLDERS moves to internal/ so metaFormatting no longer imports core/settings. Docs land in the README pretty section, RECIPES 16 and the llms.txt pretty bullet; the browser bundle budget grows to 23_000 for the feature.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development #386 +/- ##
=============================================
Coverage 100.00% 100.00%
=============================================
Files 53 54 +1
Lines 4632 4660 +28
Branches 1417 1433 +16
=============================================
+ Hits 4632 4660 +28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merged
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.
Supersedes #380 by @clayzx (cherry-picked with their authorship; thank you!) with a follow-up commit addressing the review.
Feature
pretty.placeholdersregisters custom{{token}}s forpretty.template. Each callback gets(meta, pretty)and returns a string or number; style the token throughpretty.styleslike a built-in, so a composite value such asHH:mm:ss.SSSis colored as one unit. Only referenced tokens run, a throw renders empty (never drops the log), built-in names are reserved, sub-loggers inherit the parent's map. Meta template only — error templates and JSON output are unchanged.Follow-up on top of #380
IPrettyLogStylesaccepts any key so custom tokens can be styled; a misspelled built-in key is therefore reported at runtime instead (UNKNOWN_PRETTY_STYLEwith a did-you-mean; dev warning, throws understrictConfig).KNOWN_PRETTY_PLACEHOLDERSmoved tosrc/internal/prettyPlaceholders.tssointernal/no longer importscore/settings.### Custom placeholderssubsection + settings table, RECIPES 16,llms.txtpretty bullet, CHANGELOG 5.3.0 entry.Verification
Vitest 1693 tests at 100% coverage, Biome,
check-doc-sync,audit-sideeffects, build, Deno adapter, Bun, and all 321 Playwright tests on Chromium/Firefox/WebKit.