Skip to content

Task-selective logging support #924

Description

@klenze

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions