Comments (15)
I like the options object route. But I do understand the desire to replicate as much as possible the debug
methodology. I would be happy if the options object accepted a useEnv: true
property so that it is clear to the reader where to look for the rest of the configuration. And any other properties supplied, trace
, info
, etc. could override the settings in the environment.
from pino.
I have used debug
once or twice because it seemed to be "the way things are done." But I'm not really a fan. In my opinion the reasoning behind debug
is that the library using it shouldn't have its own logger because it is meant to be included in a larger application (which would have its own logger). I think in such cases that if logging is to be done then it should:
- require
abstract-logging
- log all development, aka
debug
, logs to.trace()
- log error messages to
.error()
- log error stack traces to
.debug()
- tell the user of the library that they can supply an
abstract-logging
compatible logger to get messages, e.g.pino
Items 3 and 4 are optional; I just like to do it that way.
That being said, I'm not opposed to pino-debug
existing.
from pino.
I'm not fond of the idea of pino-debug
. We should probably do something new for development. Recently I'm doing tap test.js | pino
to get some good looking output.
We can easily draw some parallelism between debug ENV filters and pino child loggers. We might just need a way to control those using ENV.
from pino.
Perhaps another interesting idea is to at least capture debug
logs. Many libraries are using debug
internally, so it would be great if we could setup Pino to capture those logs and route to a single location.
from pino.
@marwanhilmi you've just opened up a whole new way to think about this
require pino-debug in your entry point, if NODE_ENV is production, all debug logs are enabled but go through pino (also, we could allow a mapper, so each name space could be mapped to a log (info, error, debug etc) type if desired.
This would really create a logging firehose because all you deps logs (and core too if we want) would be turned on
from pino.
Let me want to address two problems:
a. intercept the debug content of dependencies we have no control with
b. easy migration from debug of apps from debug to pino
IMHO, we should do the first.
If NODE_ENV=production
and if NODE_DEBUG=express:*
, all express related content ends up in the debug (or trace?) debug layer. Enabling everything is a little bit scary, because we might loose some flexibility that debug gives us.
from pino.
i think 1 too - what if we actually do
$ PINO_TRACE=fs,net,http PINO_DEBUG=express:* PINO_INFO=myApp:* node app.js
from pino.
I really don't like relying on environment variables. They are an external state that make it difficult to figure out what is wrong when their presence is missing or they are set incorrectly.
from pino.
I absolutely agree with you @jsumners. This is a way to get some data out from debug
. I'm not even sure it's a good idea.
from pino.
the value here for a production set up is fine grain control over debug output that's in the same logging format, with minimum overhead.
The other way is an options object
require('pino-debug')({
trace: 'fs, http, net',
debug: 'express:*',
info: 'myApp:*'
})
from pino.
PoC - https://github.com/pinojs/pino-debug
Note the benchmarks: https://github.com/pinojs/pino-debug#benchmarks
Only thing left is to get feedback and write unit tests /cc @jsumners @mcollina
from pino.
also try out the example folder (express app with pino-debug
)
from pino.
Preloaders are awesome. Go ahead and release that, add something to the README over here as well. Good job Dave!
from pino.
Very crafty. I'm quite impressed.
Seeing how you're applying runbench to more things, I suppose it really should be made into its own module. Let's discuss it and figure out what it would really need to be complete.
from pino.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from pino.
Related Issues (20)
- [question] How do I create dynamic customized logfile names? HOT 3
- Inclusive language suggestion: rename default branch to "main" across Pino's repos HOT 3
- Bundling to `ESM` using `vite` HOT 1
- ESLint: Unsafe call of an `any` typed value.(@typescript-eslint/no-unsafe-call) HOT 2
- Applying regex to redact keys or value HOT 3
- Accessing log level label from transport HOT 6
- Verifying logs from unit tests (again!) HOT 6
- `pino.transport.pipeline` may have lost logs HOT 10
- Docs: Pino Logging with Grafana Promtail/Loki HOT 3
- [Question] Same logger for both node and browser HOT 3
- Using pino with nextjs HOT 2
- Transport is not being waited for in lambda HOT 3
- pino assign takes only http context HOT 1
- Import error when using worker with pkg HOT 1
- Release, Tag and Changelog Entry needed for v9 Release HOT 1
- v9 release doesn't list breaking changes HOT 2
- Promise catch directly calling error log results in "Cannot read properties of undefined" exception HOT 1
- [Config] pinoWillSendConfig leads to configuration mutation HOT 3
- After building 'unable to determine transport target for "@axiomhq/pino"' due to "cjs" folder being deleted after build HOT 1
- `browser.formatters.level` does not inline attributes into message anymore HOT 1
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.