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

pass mkdir option on pino/file transport to destination #1223

Merged

Conversation

@mojavelinux
Copy link
Contributor

@mojavelinux mojavelinux commented Nov 16, 2021

If mkdir option is specified on the pino/file transport, pass it to the pino.destination.

closes #1221

@mojavelinux mojavelinux force-pushed the issue-1221-pino-file-mkdir-option branch from 6c285cc to bc93da6 Nov 16, 2021
Copy link
Member

@mcollina mcollina left a comment

Could you add the documentation for this "new" option? Thanks!

@mojavelinux
Copy link
Contributor Author

@mojavelinux mojavelinux commented Nov 16, 2021

@mojavelinux mojavelinux force-pushed the issue-1221-pino-file-mkdir-option branch from bc93da6 to 5cd6127 Nov 17, 2021
@@ -4,7 +4,9 @@ const pino = require('./pino')
const { once } = require('events')

module.exports = async function (opts = {}) {
const destination = pino.destination({ dest: opts.destination || 1, sync: false })
const destOpts = { dest: opts.destination || 1, sync: false }
if (opts.mkdir) destOpts.mkdir = true
Copy link
Contributor

@kibertoad kibertoad Nov 17, 2021

Choose a reason for hiding this comment

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

why not add ternary condition on destOpts instead?

Copy link
Contributor Author

@mojavelinux mojavelinux Nov 17, 2021

Choose a reason for hiding this comment

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

I'm happy to write it any way that's acceptable to the project. Adding an undefined property broke an existing test. I wrote it in such a way that the existing test would pass.

@mojavelinux
Copy link
Contributor Author

@mojavelinux mojavelinux commented Nov 17, 2021

I've added a paragraph with an example to the transports.md docs as requested. Let me know if there's anything you'd like me to change.

Copy link
Member

@mcollina mcollina left a comment

lgtm

@mcollina mcollina merged commit 2987244 into pinojs:master Nov 18, 2021
12 checks passed
@mcollina
Copy link
Member

@mcollina mcollina commented Nov 18, 2021

@mojavelinux could you send another PR with the append flag?

@mojavelinux
Copy link
Contributor Author

@mojavelinux mojavelinux commented Nov 18, 2021

Yep! On it.

@mojavelinux mojavelinux deleted the issue-1221-pino-file-mkdir-option branch Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants