Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Updates to pino v7, as pino.multistream is already in pino. #76

Merged
merged 3 commits into from
Oct 14, 2021

Conversation

mcollina
Copy link
Member

I also updated tap.

@mcollina mcollina mentioned this pull request Oct 11, 2021
13 tasks
benchmark.js Show resolved Hide resolved
@mcollina mcollina merged commit 1fb42f6 into master Oct 14, 2021
@mcollina mcollina deleted the update-to-pino-v7 branch October 14, 2021 08:32
@glensc
Copy link

glensc commented Mar 13, 2022

pino.multistream is already in pino

what does this mean? this package is no longer needed to handle multiple streams?

I how to do the example In readme without pino-multi-stream package?

var fs = require('fs')
var pinoms = require('pino-multi-stream')
var streams = [
  {stream: fs.createWriteStream('/tmp/info.stream.out')},
  {level: 'fatal', stream: fs.createWriteStream('/tmp/fatal.stream.out')}
]
var log = pinoms({streams: streams})

@mcollina
Copy link
Member Author

That's the only thing that is left in this module. We can create a multistream with https://getpino.io/#/docs/help?id=multi-stream.

@glensc
Copy link

glensc commented Mar 14, 2022

Sorry, what is the "that's" that's left in this module? what is what can't be done with pino 7?

@mcollina
Copy link
Member Author

This is the equivalent of the previous example using "just" pino:

var fs = require('fs')
var pino = require('pino')
var streams = [
  {level: 'debug', stream: fs.createWriteStream('/tmp/debug.stream.out')},
  {level: 'fatal', stream: fs.createWriteStream('/tmp/fatal.stream.out')}
]

var log = pino({
  level: 'debug' // this MUST be set at the lowest level of the
                 // destinations
}, pino.multistream(streams))

It's a nice wrapper on top of it, fixing the levels so that there is no needed for manually managing it.

@glensc
Copy link

glensc commented Mar 14, 2022

And what is that different from something like this?

    const transport = pino.transport({
      targets: [
        {
          level: 'debug',
          target: "pino-pretty",
          options: {},
        },
        {
          level: "trace",
          target: "pino/file",
          options: { destination: "/path/to/store/logs" },
        }],
    })
    const logger = pino({
      transport,
    });

@mcollina
Copy link
Member Author

Nothing in practice, it's more of a convenience method.

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

Successfully merging this pull request may close these issues.

3 participants