GithubHelp home page GithubHelp logo

Comments (2)

pimterry avatar pimterry commented on June 11, 2024 1

That's because of your implementation: you're wrapping the raw method in your own function, so that is included in the source line. There's more detail in the 2nd paragraph of the plugin docs: https://github.com/pimterry/loglevel#writing-plugins.

The only way to avoid this is to call rawMethod without adding a function wrapper. For some use cases (e.g. prefixing a fixed string) you can do this by using bind instead, e.g. return rawMethod.bind(console, 'prefix') will return a log method that logs 'prefix' before every line.

For other cases though, where you want to add dynamic behaviour, what you're asking for impossible. In general you can't wrap console logging in a function but ask the browser to ignore that function.

As a workaround, you might be able to hide the lines you don't care about by configuring your browser developer tools to blackbox the script you don't want included, see https://antongunnarsson.com/devtools-blackbox/ for some details. I'm not sure if that will work in all cases though, and it depends on your browser's config - you can't build it into your logging code.

This is a limitation of browsers and JavaScript in general, not something to do with loglevel, so I'm going to close this for now.

from loglevel.

pslzr avatar pslzr commented on June 11, 2024

Thank you for your help. Best regards..

from loglevel.

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.