Giter Site home page Giter Site logo

pino-debug about pino HOT 15 CLOSED

davidmarkclements avatar davidmarkclements commented on May 13, 2024
pino-debug

from pino.

Comments (15)

jsumners avatar jsumners commented on May 13, 2024 1

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.

jsumners avatar jsumners commented on May 13, 2024

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:

  1. require abstract-logging
  2. log all development, aka debug, logs to .trace()
  3. log error messages to .error()
  4. log error stack traces to .debug()
  5. 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.

mcollina avatar mcollina commented on May 13, 2024

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.

marwanhilmi avatar marwanhilmi commented on May 13, 2024

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.

davidmarkclements avatar davidmarkclements commented on May 13, 2024

@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.

mcollina avatar mcollina commented on May 13, 2024

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.

davidmarkclements avatar davidmarkclements commented on May 13, 2024

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.

jsumners avatar jsumners commented on May 13, 2024

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.

mcollina avatar mcollina commented on May 13, 2024

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.

davidmarkclements avatar davidmarkclements commented on May 13, 2024

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.

davidmarkclements avatar davidmarkclements commented on May 13, 2024

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.

davidmarkclements avatar davidmarkclements commented on May 13, 2024

also try out the example folder (express app with pino-debug)

from pino.

mcollina avatar mcollina commented on May 13, 2024

Preloaders are awesome. Go ahead and release that, add something to the README over here as well. Good job Dave!

from pino.

jsumners avatar jsumners commented on May 13, 2024

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.

github-actions avatar github-actions commented on May 13, 2024

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)

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.