Giter Site home page Giter Site logo

Comments (5)

wbt avatar wbt commented on June 26, 2024

It looks like the core issue here may be in the bson library, imported via mongodb.
Supposing the error is caught, what do you think should happen in the catch block?

from winston-mongodb.

erodriguezds avatar erodriguezds commented on June 26, 2024

@wbt, thanks for your prompt reply

As I proposed in the original post, It would be nice to, maybe (it's just an idea) have an "onError" option, or "onUnhandledError", you pick the name, which could be a callback provided by the user, and, on any error that may occur with the uderlying mongodb connection, invoke this callback provided by the user, and let the user decide what to do with this broken/failed log... and, if no callback is provided, then: do nothing, but at least catch the error, and don't let the application crash.

from winston-mongodb.

wbt avatar wbt commented on June 26, 2024

@erodriguezds Emitting an event seems sensible, but I think a crash in the no-listener case is reasonable because we don't want folks thinking their logs are working just fine only to find out after it really matters that they weren't.

from winston-mongodb.

erodriguezds avatar erodriguezds commented on June 26, 2024

@wbt , I'm glad you guys find the error handler sensible... hope you can work on this as a "feature request".

Regarding the crash in a no-error-handler case, I think it's quite arguable... keep in mind that this library is just a logging "transport"... the user may use other transports as well... and this is actually our case. We also use a Slack-webhook transport to receive critical messages.... so, imagine the slack service is down.. do you think the slack transport should crash my app because there's a problem with Slack? My other transports are still working!

from winston-mongodb.

wbt avatar wbt commented on June 26, 2024

@wbt , I'm glad you guys find the error handler sensible... hope you can work on this as a "feature request".

I don't currently use the MongoDB transport at all, so I'm not going to be working on that anytime soon, and I'm not even the best choice of person for reviewing/testing a proposal from someone else (here's to hoping another maintainer might raise their hand to take that review on!). Winston currently has zero budget for maintainers and PRs for both bugfixes and new features come from the community.

In the no-error-handler case, I think your arrangement with multiple handlers is not the norm, but it does seem reasonable to limit the app-crash outcome to a situation where all transports (or all transports above a certain log level) have errored out.

from winston-mongodb.

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.