A single log component configuration. More...
#include "log.h"
Public Types | |
typedef std::map< std::string, LogComponent * > | ComponentList |
LogComponent name map. More... | |
Public Member Functions | |
LogComponent (const std::string &name, const std::string &file, const enum LogLevel mask=LOG_NONE) | |
Constructor. More... | |
void | Disable (const enum LogLevel level) |
Disable logging at level for this LogComponent. More... | |
void | Enable (const enum LogLevel level) |
Enable this LogComponent at level . More... | |
std::string | File (void) const |
Get the compilation unit defining this LogComponent. More... | |
bool | IsEnabled (const enum LogLevel level) const |
Check if this LogComponent is enabled for level . More... | |
bool | IsNoneEnabled (void) const |
Check if all levels are disabled. More... | |
char const * | Name (void) const |
Get the name of this LogComponent. More... | |
void | SetMask (const enum LogLevel level) |
Prevent the enabling of a specific LogLevel. More... | |
Static Public Member Functions | |
static ComponentList * | GetComponentList (void) |
Get the list of LogComponnents. More... | |
static std::string | GetLevelLabel (const enum LogLevel level) |
Get the string label for the given LogLevel. More... | |
Private Member Functions | |
void | EnvVarCheck (void) |
Parse the NS_LOG environment variable for options relating to this LogComponent. More... | |
Private Attributes | |
std::string | m_file |
File defining this LogComponent. More... | |
int32_t | m_levels |
Enabled LogLevels. More... | |
int32_t | m_mask |
Blocked LogLevels. More... | |
std::string | m_name |
LogComponent name. More... | |
typedef std::map<std::string, LogComponent *> ns3::LogComponent::ComponentList |
LogComponent name map.
ns3::LogComponent::LogComponent | ( | const std::string & | name, |
const std::string & | file, | ||
const enum 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 114 of file log.cc.
References EnvVarCheck(), GetComponentList(), and NS_FATAL_ERROR.
void ns3::LogComponent::Disable | ( | const enum LogLevel | level | ) |
Disable logging at level
for this LogComponent.
[in] | level | The LogLevel to disable. |
Definition at line 315 of file log.cc.
References m_levels.
void ns3::LogComponent::Enable | ( | const enum LogLevel | level | ) |
Enable this LogComponent at level
.
[in] | level | The LogLevel to enable. |
Definition at line 309 of file log.cc.
References m_levels, and m_mask.
Referenced by EnvVarCheck().
|
private |
Parse the NS_LOG
environment variable for options relating to this LogComponent.
Definition at line 152 of file log.cc.
References Enable(), ns3::LOG_DEBUG, ns3::LOG_ERROR, ns3::LOG_FUNCTION, ns3::LOG_INFO, ns3::LOG_LEVEL_ALL, ns3::LOG_LEVEL_DEBUG, ns3::LOG_LEVEL_ERROR, ns3::LOG_LEVEL_FUNCTION, ns3::LOG_LEVEL_INFO, ns3::LOG_LEVEL_LOGIC, ns3::LOG_LEVEL_WARN, ns3::LOG_LOGIC, ns3::LOG_PREFIX_ALL, ns3::LOG_PREFIX_FUNC, ns3::LOG_PREFIX_LEVEL, ns3::LOG_PREFIX_NODE, ns3::LOG_PREFIX_TIME, ns3::LOG_WARN, and m_name.
Referenced by LogComponent().
std::string ns3::LogComponent::File | ( | void | ) | const |
Get the compilation unit defining this LogComponent.
Definition at line 327 of file log.cc.
References m_file.
|
static |
Get the list of LogComponnents.
Definition at line 80 of file log.cc.
Referenced by ns3::ComponentExists(), ns3::GetLogComponent(), LogComponent(), ns3::LogComponentDisable(), ns3::LogComponentDisableAll(), ns3::LogComponentEnable(), ns3::LogComponentEnableAll(), ns3::LogComponentPrintList(), and PrintAllLogComponents().
|
static |
Get the string label for the given LogLevel.
[in] | level | The LogLevel to get the label for. |
level
. Definition at line 334 of file log.cc.
References ns3::LOG_DEBUG, ns3::LOG_ERROR, ns3::LOG_FUNCTION, ns3::LOG_INFO, ns3::LOG_LOGIC, and ns3::LOG_WARN.
bool ns3::LogComponent::IsEnabled | ( | const enum 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 290 of file log.cc.
References m_levels.
bool ns3::LogComponent::IsNoneEnabled | ( | void | ) | const |
char const * ns3::LogComponent::Name | ( | void | ) | const |
Get the name of this LogComponent.
Definition at line 321 of file log.cc.
References m_name.
void ns3::LogComponent::SetMask | ( | const enum LogLevel | level | ) |
|
private |
|
private |
Enabled LogLevels.
Definition at line 439 of file log.h.
Referenced by Disable(), Enable(), IsEnabled(), and IsNoneEnabled().
|
private |
|
private |