[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Logging GR 3.9

From: Boris Marjanovic
Subject: Logging GR 3.9
Date: Thu, 29 Jul 2021 15:39:16 +1000


I've been profiling the flowgraph I've been working on and discovered that there is a lot of time spent in logging infrastructure even when logging levels were not enabled.
The logging statements are not simple strings but a call to the formatting library in my case. I used the fmt library. So the statement looks something like :
    GR_LOG_DEBUG(this->d_logger, fmt::format("a = {} b = {}", a, b));
(equivalent for any other formatting lib)
So even when the logging level is at INFO, the formatting statement will evaluate to create a string that could/should be logged.

This did not make sense to me. If the logging level is set to INFO, I would not expect the system to evaluate the above formatting statement. But it does due to the way macros are done and log4cpp manages logging statements and priority levels.

I'm curious if this is desired/expected behaviour?

I worked around this by defining a set of macros that check logger's logging level before attempting to stream a log line to the logger object.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]