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

RC config file support for programmatic usage #429

Closed
adamhamlin opened this issue Jun 9, 2023 · 4 comments · Fixed by #475
Closed

RC config file support for programmatic usage #429

adamhamlin opened this issue Jun 9, 2023 · 4 comments · Fixed by #475

Comments

@adamhamlin
Copy link
Contributor

Best I can tell, the rc files are only loaded for CLI usage (i.e., going through bin.js). Any plans to extend that to programmatic usage?

pino-pretty/bin.js

Lines 23 to 32 in 849f0fc

const joycon = new JoyCon({
parseJSON,
files: [
'pino-pretty.config.cjs',
'pino-pretty.config.js',
'.pino-prettyrc',
'.pino-prettyrc.json'
],
stopDir: path.dirname(process.cwd())
})

@jsumners
Copy link
Member

There are not any plans to do so. In my opinion, I think the readme is rather clear that this module is not meant for production use cases and adding such support would make it easier to use in unsupported contexts. The rc file support that is currently included is provided for CLI usage where providing options on each invocation is quite cumbersome otherwise. This is a common feature in CLI applications (pino-pretty's primary purpose).

I would say that if loading rc files is desired in programmatic usage, then it is the responsibility of the app.

@adamhamlin
Copy link
Contributor Author

@jsumners yep, I agree RC files are really generally meant for CLI stuff, and the readme is very clear about being non-production (and that's how we're using it). Tho if it is development-only, that basically means only developers will see it and they tend to be opinionated about formatting/aesthetics; a gitignored rc file is a good way to give them that frictionless, per-user customization.

Because it's development-only, we didn't want to pipe all our app scripts to pino-pretty--because some are used in production. We could duplicate and have development-only invocations, or make each developer wrap these scripts themselves, but that can be cumbersome, too.

All of this to say, I get it. Tho if the library had error'd when attempting to pass the option --config for programmatic use (instead of doing nothing), would've at least made things more clear

@jsumners
Copy link
Member

I do not know why config is available in https://github.com/pinojs/pino-pretty#options. A PR to remove it from that section would be welcome.

@adamhamlin
Copy link
Contributor Author

Better late than never. Opened #475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants