log: Inline LogComponent::IsEnabled() method for performance

This commit is contained in:
Max Plekh
2025-06-11 16:09:50 +03:00
committed by Gabriel Ferreira
parent 00f7415b4b
commit 2ab68f0cb6
2 changed files with 10 additions and 8 deletions

View File

@@ -232,13 +232,6 @@ LogComponent::EnvVarCheck()
Enable((LogLevel)level);
}
bool
LogComponent::IsEnabled(const LogLevel level) const
{
// LogComponentEnableEnvVar ();
return level & m_levels;
}
bool
LogComponent::IsNoneEnabled() const
{

View File

@@ -326,13 +326,22 @@ class LogComponent
* functions which help implement the logging facility.
*/
LogComponent(const std::string& name, const std::string& file, const LogLevel mask = LOG_NONE);
/**
* Check if this LogComponent is enabled for \c level
*
* @param [in] level The level to check for.
* @return \c true if we are enabled at \c level.
*
* @internal
* This function is defined in the header to enable inlining for better performance. See:
* https://gitlab.com/nsnam/ns-3-dev/-/merge_requests/2448#note_2527898962
*/
bool IsEnabled(const LogLevel level) const;
bool IsEnabled(const LogLevel level) const
{
return level & m_levels;
}
/**
* Check if all levels are disabled.
*