Comments (5)
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.
Can you provide a full reproduction?
from pino-multi-stream.
Are you looking for the dedupe
option?
from pino-multi-stream.
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.
Would you like to send a Pull Request to address this issue? Remember to add unit tests.
from pino-multi-stream.
Related Issues (20)
- Level is not being set upon initilization HOT 2
- Would it be nice to take pino to peerDependency? HOT 1
- log.child(obj).info(string) throws 'unknown level' error HOT 4
- Recreate logfile? HOT 5
- Custom levels don't behave the same with and without pino-multi-stream HOT 12
- Passing arguments to prettyStream HOT 3
- unknown level undefined error when using prettyPrint HOT 2
- multi-stream not working with pretty-print HOT 3
- Log no longer written to multiple streams HOT 2
- Log redaction not working in production HOT 2
- Destination write stream file is bloated with NUL characters at head HOT 1
- dedupe logs HOT 5
- TypeError: Cannot read property 'flushSync' of undefined HOT 1
- Not working in browser HOT 2
- Provide example how to use standard pino + one more stream HOT 9
- module crashes at the configuration stage HOT 3
- multilog HOT 1
- Steam into file HOT 1
- Deprecate this module HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pino-multi-stream.