Skip to content

Logging should evaluate only if the logging level is active #4116

@Smurf-IV

Description

@Smurf-IV

According to the following code:

	template <typename T, typename... Args>
	void fatal(const std::string& fmt, T arg1, Args&&... args)
	{
		log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_FATAL);
	}

The Format is always called for a logging line, and then the if condition to actually test if it should be "Logged" is done in the log function afterwards.

Would it not be more performant to only call the logging formatting iff the level is "Useable" ?
i.e. move the checking before the formatting

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions