Giter Club home page Giter Club logo

Comments (6)

dschatzberg avatar dschatzberg commented on August 30, 2024

Here is my thoughts for how to do this. There should be a bunch of logging functions representing various levels of output (trace, debug, warn, info, error). And each of these functions should output based on the current log level (set by default to warn perhaps, but overridable by command line or FDT or environment variable.) This way we don't have to struggle too much for when to put debug output in the code, just choose the appropriate level

from ebbrt.

jappavoo avatar jappavoo commented on August 30, 2024

We went through several designs on this topic. Questions about how to keep the checks flexible and
yet potentially eliminate them all together to avoid overheads. (eg. no memory or coherency traffic).

I am happy to chat about the approaches we have looked at in the past.

On Feb 25, 2016, at 11:15 AM, Dan Schatzberg [email protected] wrote:

Here is my thoughts for how to do this. There should be a bunch of logging functions representing various levels of output (trace, debug, warn, info, error). And each of these functions should output based on the current log level (set by default to warn perhaps, but overridable by command line or FDT or environment variable.) This way we don't have to struggle too much for when to put debug output in the code, just choose the appropriate level


Reply to this email directly or view it on GitHub #96 (comment).

from ebbrt.

dschatzberg avatar dschatzberg commented on August 30, 2024

@jappavoo
If possible, add thoughts to this post so we have it all documented.

Another feature I would desire is the ability to enable/disable output per file, perhaps having the functions pass the value of the predefined FILE macro.

from ebbrt.

jimcadden avatar jimcadden commented on August 30, 2024

logging functions representing various levels of output (trace, debug, warn, info, error)

Yes, I agree. We'd probably want both a "LogManager" Ebb, or a set of low-level kprintf-like functions (kprinf-debug(), kprintf-error(), kprintf-all()).

ability to enable/disable output per file, perhaps having the functions pass the value of the predefined FILE macro

I'm not sure I follow...a file-specific macro? E.g., __EBBRT_EVENTMANAGER__QUIET_ALL__ ?

We went through several designs on this topic.

Here's a glance into one way we had previously hacked together a 'quiet' build:
546c1f9

from ebbrt.

dschatzberg avatar dschatzberg commented on August 30, 2024

@jmcadden

I'm not sure I follow...a file-specific macro? E.g., EBBRT_EVENTMANAGER__QUIET_ALL ?

I'm motivated by the way Rust's env_logger works: https://rust-lang-nursery.github.io/log/env_logger/

GCC defines __FILE__ to be the current file name. So if we had the (for example) LOG() macro pass the file name to the logging object. Then the logging object could decide to log (or not) based on some file-specific setting. For example, suppose we could configure the log output with some variable like so: EBBRT_LOG="warn,EventManager=debug" then all log output with warn or higher (e.g. error) will be output. However, any output in the EventManager with debug or higher will be output.

from ebbrt.

jimcadden avatar jimcadden commented on August 30, 2024

For the time being: EbbRT baremetal has a compilation flag that will mute kprintf() output, along with a force_kprintf() that will print when others are muted.

from ebbrt.

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.