{{ message }}
Repository navigation
feat(browser): support pino.multistream and a destination argument - #2523
Open
kilisamemarisaaa wants to merge 2 commits into
Open
kilisamemarisaaa wants to merge 2 commits into
kilisamemarisaaa wants to merge 2 commits into
Conversation
The browser build did not export pino.multistream, so pino.multistream() threw a TypeError in the browser (issue pinojs#1686). lib/multistream.js has no Node.js-only dependencies, so the browser build now reuses it verbatim. pino() also accepts the destination as its second argument, matching the Node.js signature: when a multistream result (or any object with a write method) is passed, each log line is routed to destination.write() with lastLevel set, so the per-stream level filtering applies. The written payload is the same object the browser.write option would receive (an entry with time, level, msg and bindings); asObject is implied. Differences from Node.js, documented in docs/browser.md: the lastTime / lastMsg / lastObj metadata fields are not propagated, and the payload is a log entry object rather than a JSON line. Co-Authored-By: EvoX <evox@evomap.ai>
mcollina
reviewed
Sep 25, 2026
Member
There was a problem hiding this comment.
Can you use a for loop instead?
Author
There was a problem hiding this comment.
Replaced forEach with an indexed for loop in 95a2ddf. The per-iteration const preserves the level captured by each destination writer. Verified the browser multistream cases (7 cases / 11 assertions) and the complete npm test pipeline, including lint, runtime coverage, Jest and types. On Windows I added the existing Git usr/bin directory to the process PATH to supply mv for the unchanged fixture script.
This branch has not been deployed
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.

Summary
Closes #1686
The browser build did not export
pino.multistream, sopino.multistream()threw aTypeErrorin the browser.lib/multistream.jshas no Node.js-only dependencies, so the browser build now reuses it verbatim.pino()also accepts the destination as its second argument, matching the Node.js signature. When a multistream result (or any object with awritemethod) is passed, each log line is routed throughdestination.write()withlastLevelset, so per-stream level filtering applies exactly as in Node.The written payload is the same object the
browser.writeoption would receive (an entry withtime,level,msgand any bindings);asObjectis implied when a destination is used.browser.writeusers are unaffected.Documented differences from Node.js
lastTime/lastMsg/lastObjmetadata fields are not propagated in the browser.docs/browser.mdmovespino.multistream()out of the Node.js-only statics list and documents the browser usage.Validation
test/browser-multistream.test.js(7 tests): per-stream level filtering, bare destination, defaultinfostream level, child logger bindings routing,setBindingsreflection, and the destination validation error.npx borp --timeout 60000 'test/*test.js'→ 460 pass / 0 fail on this branch.npx eslint browser.js test/browser-multistream.test.jsclean.