poco icon indicating copy to clipboard operation
poco copied to clipboard

Optimize multi-arg logger methods to only call format() if log level allows

Open obiltschnig opened this issue 6 years ago • 2 comments

Example:

inline void Logger::debug(const std::string& fmt, const Any& value1)
{
	log(Poco::format(fmt, value1), Message::PRIO_DEBUG);
}

should become:

inline void Logger::debug(const std::string& fmt, const Any& value1)
{
	if (debug())
	{
		logAlways(Poco::format(fmt, value1), Message::PRIO_DEBUG);
	}
}

// ...

inline void Logger::logAlways(const std::string& text, Message::Priority prio, const char* file, int line)
{
	if (_pChannel)
	{
		_pChannel->log(Message(_name, text, prio, file, line));
	}
}

obiltschnig avatar May 15 '18 12:05 obiltschnig

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Jul 01 '22 03:07 github-actions[bot]

This issue was closed because it has been inactive for 60 days since being marked as stale.

github-actions[bot] avatar Aug 30 '22 03:08 github-actions[bot]