Skip to content
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

console: add inspectOptions option #24978

Closed
wants to merge 3 commits into from

Conversation

BridgeAR
Copy link
Member

Add an inspectOptions option to the console constructor. That
way it's possible to define all inspection defaults for each
console instance instead of relying on the inspect() defaults.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Add an `inspectOptions` option to the `console` constructor. That
way it's possible to define all inspection defaults for each
`console` instance instead of relying on the `inspect()` defaults.
@BridgeAR BridgeAR added the semver-minor PRs that contain new features and should be released in the next minor version. label Dec 12, 2018
@nodejs-github-bot nodejs-github-bot added console Issues and PRs related to the console subsystem. errors Issues and PRs related to JavaScript errors originated in Node.js core. labels Dec 12, 2018
@BridgeAR
Copy link
Member Author

@BridgeAR
Copy link
Member Author

@nodejs/util PTAL

doc/api/console.md Outdated Show resolved Hide resolved
Co-Authored-By: BridgeAR <[email protected]>
@BridgeAR
Copy link
Member Author

BridgeAR commented Dec 13, 2018

@BridgeAR
Copy link
Member Author

This could use some reviews.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would a user change the inspectOptions of the global/default console? It seems a needed feature.

If that's possible, we should document it and maybe add a test for it.

@BridgeAR
Copy link
Member Author

BridgeAR commented Dec 14, 2018

@mcollina that's possible by changing util.inspect.defaultOptions. It is document in the util part. However, I would not want to document this any more prominent, since it's already used in userland modules and that's a pretty bad anti pattern. I am afraid more modules might change these defaults instead of relying on an individual logging instance (where it's totally fine to change the settings to their own needs).

The question does not seem to be directly related to this PR though.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 14, 2018
@Trott
Copy link
Member

Trott commented Dec 15, 2018

Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/19556/ ✔️

addaleax
addaleax previously approved these changes Dec 15, 2018
doc/api/errors.md Outdated Show resolved Hide resolved
lib/internal/console/constructor.js Show resolved Hide resolved
@BridgeAR
Copy link
Member Author

BridgeAR commented Dec 16, 2018

@Trott Trott removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 16, 2018
@Trott
Copy link
Member

Trott commented Dec 16, 2018

Removed author ready pending result of the conversation started in #24978 (comment). Just being cautious. No objections from me to landing.

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 17, 2018
@addaleax addaleax dismissed their stale review December 17, 2018 14:39

has enough approvals

BridgeAR added a commit to BridgeAR/node that referenced this pull request Dec 17, 2018
Add an `inspectOptions` option to the `console` constructor. That
way it's possible to define all inspection defaults for each
`console` instance instead of relying on the `inspect()` defaults.

PR-URL: nodejs#24978
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
@BridgeAR
Copy link
Member Author

Landed in be3ae33

@MylesBorins
Copy link
Contributor

The tests for this PR fail on 11.x. Would someone be willing to open a backport?

@BridgeAR
Copy link
Member Author

BridgeAR commented Jan 9, 2019

This relies on other console PRs and we should wait till those are backported. This should land cleanly afterwards.

BridgeAR added a commit that referenced this pull request Jan 10, 2019
Add an `inspectOptions` option to the `console` constructor. That
way it's possible to define all inspection defaults for each
`console` instance instead of relying on the `inspect()` defaults.

PR-URL: #24978
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
@BridgeAR
Copy link
Member Author

I was able to backport this directly to the staging branch due to recent console backports.

addaleax pushed a commit that referenced this pull request Jan 14, 2019
Add an `inspectOptions` option to the `console` constructor. That
way it's possible to define all inspection defaults for each
`console` instance instead of relying on the `inspect()` defaults.

PR-URL: #24978
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
Add an `inspectOptions` option to the `console` constructor. That
way it's possible to define all inspection defaults for each
`console` instance instead of relying on the `inspect()` defaults.

PR-URL: nodejs#24978
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Jan 16, 2019
BridgeAR added a commit to BridgeAR/node that referenced this pull request Jan 17, 2019
Notable Changes

* compression / zlib:
  * Added brotli support (Anna Henningsen and Zach Vacura)
    nodejs#24938
* console:
  * Added `inspectOptions` option (Ruben Bridgewater)
    nodejs#24978
* crypto:
  * Always accept private keys as public keys (Tobias Nießen)
    nodejs#25217
* deps:
  * Upgrade npm to v6.5.0 (Jordan Harband)
    nodejs#25234
* fs:
  * Use internalBinding('fs') internally instead of
    process.binding('fs') (Masashi Hirano)
    nodejs#22478
* http(s):
  * Support overriding http\\s.globalAgent (Roy Sommer)
    nodejs#25170
* util:
  * Inspect ArrayBuffers contents closely (Ruben Bridgewater)
    nodejs#25006
* worker:
  * Expose workers by default and remove `--experimental-worker` flag
    (Anna Henningsen) nodejs#25361

PR-URL: nodejs#25537
BridgeAR added a commit that referenced this pull request Jan 18, 2019
Notable Changes

* compression / zlib:
  * Added brotli support (Anna Henningsen and Zach Vacura)
    #24938
* console:
  * Added `inspectOptions` option (Ruben Bridgewater)
    #24978
* crypto:
  * Always accept private keys as public keys (Tobias Nießen)
    #25217
* deps:
  * Upgrade npm to v6.5.0 (Jordan Harband)
    #25234
* fs:
  * Use internalBinding('fs') internally instead of
    process.binding('fs') (Masashi Hirano)
    #22478
* http(s):
  * Support overriding http\\s.globalAgent (Roy Sommer)
    #25170
* util:
  * Inspect ArrayBuffers contents closely (Ruben Bridgewater)
    #25006
* worker:
  * Expose workers by default and remove `--experimental-worker` flag
    (Anna Henningsen) #25361

PR-URL: #25537
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2019
@BridgeAR BridgeAR deleted the pass-through-console-options branch January 20, 2020 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. console Issues and PRs related to the console subsystem. errors Issues and PRs related to JavaScript errors originated in Node.js core. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants