-
Notifications
You must be signed in to change notification settings - Fork 938
apply serializers to args once before asObject or transmit #1971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apply serializers to args once before asObject or transmit #1971
Conversation
| } | ||
| logObject.level = levelFormatter(level, logger.levels.values[level]) | ||
|
|
||
| if (levelFormatter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restore previous implementation to fix this bug
| if (stdErrSerialize && args[i] instanceof Error) { | ||
| args[i] = pino.stdSerializers.err(args[i]) | ||
| } else if (typeof args[i] === 'object' && !Array.isArray(args[i])) { | ||
| } else if (typeof args[i] === 'object' && !Array.isArray(args[i]) && serialize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to start a for loop, if serialize is not true
| first object (as in server pino). | ||
|
|
||
| For more info on serializers see https://github.com/pinojs/pino/blob/master/docs/api.md#parameters. | ||
| For more info on serializers see https://github.com/pinojs/pino/blob/master/docs/api.md#mergingobject. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix docs id references
|
|
||
| test('children serializers get called', ({ end, is }) => { | ||
| const parent = pino({ | ||
| test: 'this', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not part of the pino config, or log parameters, seems like a mistake
| }) | ||
|
|
||
| test('opts.browser.formatters logs pino-like object to console', ({ end, ok, is }) => { | ||
| test('opts.browser.formatters (level) logs pino-like object to console', ({ end, ok, is }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test names were the same, adding context for the different formatters config
| end() | ||
| }) | ||
|
|
||
| test('opts.browser.write func string joining when asObject is true', ({ end, ok, is }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test was repeated, see line 262 below, I deleted this, git somehow is reconciling my changes adding new test using the these lines
| for (var i = 0; i < args.length; i++) args[i] = arguments[i] | ||
|
|
||
| if (opts.serialize && !opts.asObject) { | ||
| if (opts.serialize && !opts.transmit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the required change to fix the bug
mcollina
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [pino](https://getpino.io) ([source](https://github.com/pinojs/pino)) | [`^8.18.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/pino/8.21.0/9.1.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>pinojs/pino (pino)</summary> ### [`v9.1.0`](https://github.com/pinojs/pino/releases/tag/v9.1.0) [Compare Source](https://github.com/pinojs/pino/compare/v9.0.0...v9.1.0) #### What's Changed - fix(transport-stream): Fix import error when using pkg with node v20 by [@​nagyszabi](https://github.com/nagyszabi) in [https://github.com/pinojs/pino/pull/1949](https://github.com/pinojs/pino/pull/1949) - Update LTS doc by [@​jsumners](https://github.com/jsumners) in [https://github.com/pinojs/pino/pull/1955](https://github.com/pinojs/pino/pull/1955) - Update pino types for browser.formatters by [@​KatelynKim](https://github.com/KatelynKim) in [https://github.com/pinojs/pino/pull/1946](https://github.com/pinojs/pino/pull/1946) - add node v22 to CI by [@​mcollina](https://github.com/mcollina) in [https://github.com/pinojs/pino/pull/1953](https://github.com/pinojs/pino/pull/1953) - Add Platformatic to sponsors by [@​mcollina](https://github.com/mcollina) in [https://github.com/pinojs/pino/pull/1956](https://github.com/pinojs/pino/pull/1956) - Update h3 example by [@​mcollina](https://github.com/mcollina) in [https://github.com/pinojs/pino/pull/1968](https://github.com/pinojs/pino/pull/1968) - Support file URLs when configuring multiple transports by [@​haines](https://github.com/haines) in [https://github.com/pinojs/pino/pull/1961](https://github.com/pinojs/pino/pull/1961) - Adding support for mix\&match pipelines by [@​dbacarel](https://github.com/dbacarel) in [https://github.com/pinojs/pino/pull/1954](https://github.com/pinojs/pino/pull/1954) - apply serializers to args once before asObject or transmit by [@​emmyakin](https://github.com/emmyakin) in [https://github.com/pinojs/pino/pull/1971](https://github.com/pinojs/pino/pull/1971) - build(deps-dev): bump pino-pretty from 10.3.1 to 11.0.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1933](https://github.com/pinojs/pino/pull/1933) - build(deps): bump sonic-boom from 3.8.1 to 4.0.1 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1960](https://github.com/pinojs/pino/pull/1960) - build(deps): bump pino-std-serializers from 6.2.2 to 7.0.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1957](https://github.com/pinojs/pino/pull/1957) - build(deps-dev): bump tsd from 0.30.7 to 0.31.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1937](https://github.com/pinojs/pino/pull/1937) - build(deps): bump actions/dependency-review-action from 3 to 4 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1894](https://github.com/pinojs/pino/pull/1894) - build(deps): bump pnpm/action-setup from 2.4.0 to 3.0.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1913](https://github.com/pinojs/pino/pull/1913) - Drop yarn support and update pnpm by [@​mcollina](https://github.com/mcollina) in [https://github.com/pinojs/pino/pull/1972](https://github.com/pinojs/pino/pull/1972) - build(deps): bump thread-stream from 2.7.0 to 3.0.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1959](https://github.com/pinojs/pino/pull/1959) #### New Contributors - [@​nagyszabi](https://github.com/nagyszabi) made their first contribution in [https://github.com/pinojs/pino/pull/1949](https://github.com/pinojs/pino/pull/1949) - [@​haines](https://github.com/haines) made their first contribution in [https://github.com/pinojs/pino/pull/1961](https://github.com/pinojs/pino/pull/1961) - [@​emmyakin](https://github.com/emmyakin) made their first contribution in [https://github.com/pinojs/pino/pull/1971](https://github.com/pinojs/pino/pull/1971) **Full Changelog**: pinojs/pino@v9.0.0...v9.1.0 ### [`v9.0.0`](https://github.com/pinojs/pino/compare/v8.21.0...4f8ea32aa69ec94b2fb5561716a7701aec991ce7) [Compare Source](https://github.com/pinojs/pino/compare/v8.21.0...v9.0.0) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/rustymotors/server). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMTMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjM1MS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [pino](https://getpino.io) ([source](https://github.com/pinojs/pino)) | [`8.21.0` -> `9.3.1`](https://renovatebot.com/diffs/npm/pino/8.21.0/9.3.1) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>pinojs/pino (pino)</summary> ### [`v9.3.1`](https://github.com/pinojs/pino/releases/tag/v9.3.1) [Compare Source](https://github.com/pinojs/pino/compare/v9.3.0...v9.3.1) **Full Changelog**: pinojs/pino@v9.3.0...v9.3.1 ### [`v9.3.0`](https://github.com/pinojs/pino/compare/v9.2.0...92f2cee98e83d3f864b228a6e1dc29a31e54ba49) [Compare Source](https://github.com/pinojs/pino/compare/v9.2.0...v9.3.0) ### [`v9.2.0`](https://github.com/pinojs/pino/releases/tag/v9.2.0) [Compare Source](https://github.com/pinojs/pino/compare/v9.1.0...v9.2.0) #### What's Changed - shallow clone target options by [@​mcollina](https://github.com/mcollina) in [https://github.com/pinojs/pino/pull/1973](https://github.com/pinojs/pino/pull/1973) - add logger instance as third parameter by [@​emmyakin](https://github.com/emmyakin) in [https://github.com/pinojs/pino/pull/1977](https://github.com/pinojs/pino/pull/1977) - use boolean flag to ensure serializers are applied once by [@​emmyakin](https://github.com/emmyakin) in [https://github.com/pinojs/pino/pull/1976](https://github.com/pinojs/pino/pull/1976) - suppport messageKey in pino/browser by [@​emmyakin](https://github.com/emmyakin) in [https://github.com/pinojs/pino/pull/1980](https://github.com/pinojs/pino/pull/1980) - Fixing browser side child log issue ([#​960](https://github.com/pinojs/pino/issues/960)) child level can now be set at cr… by [@​stevel032](https://github.com/stevel032) in [https://github.com/pinojs/pino/pull/1986](https://github.com/pinojs/pino/pull/1986) #### New Contributors - [@​stevel032](https://github.com/stevel032) made their first contribution in [https://github.com/pinojs/pino/pull/1986](https://github.com/pinojs/pino/pull/1986) **Full Changelog**: pinojs/pino@v9.1.0...v9.2.0 ### [`v9.1.0`](https://github.com/pinojs/pino/releases/tag/v9.1.0) [Compare Source](https://github.com/pinojs/pino/compare/v9.0.0...v9.1.0) #### What's Changed - fix(transport-stream): Fix import error when using pkg with node v20 by [@​nagyszabi](https://github.com/nagyszabi) in [https://github.com/pinojs/pino/pull/1949](https://github.com/pinojs/pino/pull/1949) - Update LTS doc by [@​jsumners](https://github.com/jsumners) in [https://github.com/pinojs/pino/pull/1955](https://github.com/pinojs/pino/pull/1955) - Update pino types for browser.formatters by [@​KatelynKim](https://github.com/KatelynKim) in [https://github.com/pinojs/pino/pull/1946](https://github.com/pinojs/pino/pull/1946) - add node v22 to CI by [@​mcollina](https://github.com/mcollina) in [https://github.com/pinojs/pino/pull/1953](https://github.com/pinojs/pino/pull/1953) - Add Platformatic to sponsors by [@​mcollina](https://github.com/mcollina) in [https://github.com/pinojs/pino/pull/1956](https://github.com/pinojs/pino/pull/1956) - Update h3 example by [@​mcollina](https://github.com/mcollina) in [https://github.com/pinojs/pino/pull/1968](https://github.com/pinojs/pino/pull/1968) - Support file URLs when configuring multiple transports by [@​haines](https://github.com/haines) in [https://github.com/pinojs/pino/pull/1961](https://github.com/pinojs/pino/pull/1961) - Adding support for mix\&match pipelines by [@​dbacarel](https://github.com/dbacarel) in [https://github.com/pinojs/pino/pull/1954](https://github.com/pinojs/pino/pull/1954) - apply serializers to args once before asObject or transmit by [@​emmyakin](https://github.com/emmyakin) in [https://github.com/pinojs/pino/pull/1971](https://github.com/pinojs/pino/pull/1971) - build(deps-dev): bump pino-pretty from 10.3.1 to 11.0.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1933](https://github.com/pinojs/pino/pull/1933) - build(deps): bump sonic-boom from 3.8.1 to 4.0.1 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1960](https://github.com/pinojs/pino/pull/1960) - build(deps): bump pino-std-serializers from 6.2.2 to 7.0.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1957](https://github.com/pinojs/pino/pull/1957) - build(deps-dev): bump tsd from 0.30.7 to 0.31.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1937](https://github.com/pinojs/pino/pull/1937) - build(deps): bump actions/dependency-review-action from 3 to 4 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1894](https://github.com/pinojs/pino/pull/1894) - build(deps): bump pnpm/action-setup from 2.4.0 to 3.0.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1913](https://github.com/pinojs/pino/pull/1913) - Drop yarn support and update pnpm by [@​mcollina](https://github.com/mcollina) in [https://github.com/pinojs/pino/pull/1972](https://github.com/pinojs/pino/pull/1972) - build(deps): bump thread-stream from 2.7.0 to 3.0.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/pinojs/pino/pull/1959](https://github.com/pinojs/pino/pull/1959) #### New Contributors - [@​nagyszabi](https://github.com/nagyszabi) made their first contribution in [https://github.com/pinojs/pino/pull/1949](https://github.com/pinojs/pino/pull/1949) - [@​haines](https://github.com/haines) made their first contribution in [https://github.com/pinojs/pino/pull/1961](https://github.com/pinojs/pino/pull/1961) - [@​emmyakin](https://github.com/emmyakin) made their first contribution in [https://github.com/pinojs/pino/pull/1971](https://github.com/pinojs/pino/pull/1971) **Full Changelog**: pinojs/pino@v9.0.0...v9.1.0 ### [`v9.0.0`](https://github.com/pinojs/pino/compare/v8.21.0...4f8ea32aa69ec94b2fb5561716a7701aec991ce7) [Compare Source](https://github.com/pinojs/pino/compare/v8.21.0...v9.0.0) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/redwoodjs/redwood). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes serializers are applied twice in pino/browser #1970
applySerializersfunctioin mutatesargsto logger.*, this cause args to be updated twice inasObjectandtransmitasObjectAlso includes fix for
browser.formatters.leveldoes not inline attributes into message anymore #1966formatters.leveldoes not spread the returned object, but updateslogData.level = { level: 30, label: 'info' }