Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task-selective logging support #924

Closed
klenze opened this issue Oct 14, 2019 · 2 comments
Closed

Task-selective logging support #924

klenze opened this issue Oct 14, 2019 · 2 comments

Comments

@klenze
Copy link

klenze commented Oct 14, 2019

I think the ability to tune the logger on a per FairTask base would be useful.

I can think of two ways to implement this:

  • redefining the LOG macro to pass a variable -- contextLogLevel -- to Logger. A global contextLogLevel would be set to a default, while specific classes could define a field with that name to override the global level using shadowing. (Yes, a bit ugly).
  • adjusting the global log level temporarily when running FairTask::InitTasks(), FairTask::ExecuteTasks and the like. This would also propagate the log level to anything called by the task in question. (A bit of a performance overhead. OTOH, the cost of two integer assignments is probably not so bad.)

First, I thought that FairTask::SetVerbosity might already do that, but a some grepping for the use of fVerbose showed that fVerbose only controls some raw std::cout's, so that is probably predating the logger infrastructure. Clearly marking that function as "control the amount of status information written to stdout by FairTask. Not related to the logger functionality, which should be use instead." might make things less confusing.

As a cheap hack, I currently add #define DEBUG INFO locally in the task I want to debug.

@rbx
Copy link
Member

rbx commented Oct 15, 2019

If you are on a recent FairRoot you should be able to call:

fair::Logger::SetConsoleSeverity(fair::Severity::info); // or fair::Severity::debug

to get the second option you described. In this case it is really two integer assignments.
If you use SetLogScreenLevel(const char* severity) that will add a map lookup for the string conversion.

@dennisklein
Copy link
Member

@klenze I have created an issue to track your feature request in the FairLogger repository. Unfortunately, it will have a rather low priority from our side due to lack of manpower. But we are happy to review/accept any contributions.

Closing this in favor of the upstream issue. Let's continue the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants