Giter Site home page Giter Site logo

Comments (5)

lukassr avatar lukassr commented on May 26, 2024 1

Here's an example:

const pinoms = require('pino-multi-stream');
const fs = require('fs');

const logger = pinoms({
  level: 'silent',
  serializers: {
    err: pinoms.stdSerializers.err,
    req: pinoms.stdSerializers.req,
    res: pinoms.stdSerializers.res,
  },
  streams: [
    {
      stream: fs.createWriteStream('./test/info.debug.txt'),
      level: 'debug', 
    },
    {
      stream: fs.createWriteStream('./test/info.silent.txt'),
    },
  ],
});

logger.info('test');

It appears that the debug level in the child overwrites the silent level. If you run that code, you will see a log inside info.silent.txt. Also, if you check the level of logger it will be debug instead of silent.

I had to fix this putting the level in every child instead of the level in the parent.

from pino-multi-stream.

jsumners avatar jsumners commented on May 26, 2024

Can you provide a full reproduction?

from pino-multi-stream.

jsumners avatar jsumners commented on May 26, 2024

Are you looking for the dedupe option?

from pino-multi-stream.

lukassr avatar lukassr commented on May 26, 2024

Not really. dedupe will only log to the one stream with the higher level. What I'm looking is to have multiple streams, some of them sharing the same level defined in the parent but some others with specific level. In the example above, the second stream should have the silent level, because it is declare in the parent, but I think it not the case, because it will log anyways in the .txt. If you declare level:'silent' in the second stream, it will work as it should.

Thanks for the answers.

from pino-multi-stream.

jsumners avatar jsumners commented on May 26, 2024

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

from pino-multi-stream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.