A single log component configuration. More...
#include "log.h"
Public Types | |
using | ComponentList = std::unordered_map<std::string, LogComponent*> |
LogComponent name map. | |
Public Member Functions | |
LogComponent (const std::string &name, const std::string &file, const LogLevel mask=LOG_NONE) | |
Constructor. | |
void | Disable (const LogLevel level) |
Disable logging at level for this LogComponent. | |
void | Enable (const LogLevel level) |
Enable this LogComponent at level . | |
std::string | File () const |
Get the compilation unit defining this LogComponent. | |
bool | IsEnabled (const LogLevel level) const |
Check if this LogComponent is enabled for level . | |
bool | IsNoneEnabled () const |
Check if all levels are disabled. | |
std::string | Name () const |
Get the name of this LogComponent. | |
void | SetMask (const LogLevel level) |
Prevent the enabling of a specific LogLevel. | |
Static Public Member Functions | |
static ComponentList * | GetComponentList () |
Get the list of LogComponents. | |
static std::string | GetLevelLabel (const LogLevel level) |
Get the string label for the given LogLevel. | |
Private Member Functions | |
void | EnvVarCheck () |
Parse the NS_LOG environment variable for options relating to this LogComponent. | |
Private Attributes | |
std::string | m_file |
File defining this LogComponent. | |
int32_t | m_levels |
Enabled LogLevels. | |
int32_t | m_mask |
Blocked LogLevels. | |
std::string | m_name |
LogComponent name. | |
using ns3::LogComponent::ComponentList = std::unordered_map<std::string, LogComponent*> |
LogComponent name map.
ns3::LogComponent::LogComponent | ( | const std::string & | name, |
const std::string & | file, | ||
const LogLevel | mask = LOG_NONE ) |
Constructor.
[in] | name | The user-visible name for this component. |
[in] | file | The source code file which defined this LogComponent. |
[in] | mask | LogLevels blocked for this LogComponent. Blocking a log level helps prevent recursion by logging in functions which help implement the logging facility. |
Definition at line 148 of file log.cc.
References EnvVarCheck(), GetComponentList(), and NS_FATAL_ERROR.
void ns3::LogComponent::Disable | ( | const LogLevel | level | ) |
Disable logging at level
for this LogComponent.
[in] | level | The LogLevel to disable. |
Definition at line 261 of file log.cc.
References m_levels.
void ns3::LogComponent::Enable | ( | const LogLevel | level | ) |
Enable this LogComponent at level
.
[in] | level | The LogLevel to enable. |
Definition at line 255 of file log.cc.
References m_levels.
Referenced by EnvVarCheck().
|
private |
Parse the NS_LOG
environment variable for options relating to this LogComponent.
Definition at line 187 of file log.cc.
References Enable(), ns3::EnvironmentVariable::Get(), ns3::LOG_LEVEL_ALL, ns3::LOG_PREFIX_ALL, m_name, NS_ASSERT_MSG, and ns3::SplitString().
Referenced by LogComponent().
std::string ns3::LogComponent::File | ( | ) | const |
Get the compilation unit defining this LogComponent.
Definition at line 273 of file log.cc.
References m_file.
|
static |
Get the list of LogComponents.
Definition at line 132 of file log.cc.
Referenced by LogComponent(), ns3::ComponentExists(), ns3::GetLogComponent(), ns3::LogComponentDisable(), ns3::LogComponentDisableAll(), ns3::LogComponentEnable(), ns3::LogComponentEnableAll(), ns3::LogComponentPrintList(), and PrintAllLogComponents().
|
static |
bool ns3::LogComponent::IsEnabled | ( | const LogLevel | level | ) | const |
Check if this LogComponent is enabled for level
.
[in] | level | The level to check for. |
true
if we are enabled at level
. Definition at line 236 of file log.cc.
References m_levels.
bool ns3::LogComponent::IsNoneEnabled | ( | ) | const |
std::string ns3::LogComponent::Name | ( | ) | const |
Get the name of this LogComponent.
Definition at line 267 of file log.cc.
References m_name.
void ns3::LogComponent::SetMask | ( | const LogLevel | level | ) |
|
private |
|
private |
Enabled LogLevels.
Definition at line 408 of file log.h.
Referenced by Disable(), Enable(), IsEnabled(), and IsNoneEnabled().
|
private |
|
private |