Git Product home page Git Product logo

Comments (7)

jhs avatar jhs commented on June 21, 2024

Yes, this has been nagging me too! There is an attempted failsafe to no-op if the console logger is missing.

Can we clarify exactly what the bug is?

  1. Some browsers are not working because console is not defined?
  2. The failsafe (which replaces console.log() etc. with no-op functions) is not working correctly?
  3. The whole idea is dangerous and logging should be opt-in?

Frankly I can see an argument for any of these options. What would you prefer, @perezd?

from browser-request.

perezd avatar perezd commented on June 21, 2024

Actually I patched this in my branch. I export the logger and allow the caller to redefine it. Should I send you a pull request?
https://github.com/perezd/browser-request/commit/bf519d5586e6c433258ed3e5b2837b2ab905a753

from browser-request.

jhs avatar jhs commented on June 21, 2024

Awesome, yes please send a pull req.

from browser-request.

maxogden avatar maxogden commented on June 21, 2024

i wish browser request conformed to the unix law of "silence is golden":

When a program has nothing surprising to say, it should say nothing

e.g. logging should be off by default

from browser-request.

perezd avatar perezd commented on June 21, 2024

Agreed. Jason also has a habit of using Log4Js or whatever the hell and it monkey patches console.xxx. I hate that shit.

from browser-request.

jhs avatar jhs commented on June 21, 2024

First of all, if the logging activities break any browser, that is a bug. Please let me know.

I still prefer log4js, which no longer automatically monkey-patches console. However I now regret all logger usage in all my libraries. Logging is becoming a pain point.

In my new code, I now have a "log" object (defaults to console) and I assume it has the same API as console. So I call .log(), .info(), etc. The programmer can replace that with whatever logger they want, as long as it has the same API.

from browser-request.

jhs avatar jhs commented on June 21, 2024

@perezd I believe this issue corresponds with pull request #8 which I merged.

from browser-request.

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.