A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::LogComponent Class Reference

A single log component configuration. More...

#include <log.h>

+ Collaboration diagram for ns3::LogComponent:

Public Member Functions

 LogComponent (const std::string &name, 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...
 
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 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

int32_t m_levels
 Enabled LogLevels. More...
 
int32_t m_mask
 Blocked LogLevels. More...
 
std::string m_name
 LogComponent name. More...
 

Detailed Description

A single log component configuration.

Definition at line 263 of file log.h.

Constructor & Destructor Documentation

ns3::LogComponent::LogComponent ( const std::string &  name,
const enum LogLevel  mask = LOG_NONE 
)

Constructor.

Parameters
[in]namethe user-visible name for this component.
[in]maskLogLevels blocked for this LogComponent. Blocking a log level helps prevent recursion by logging in functions which help implement the logging facility.

Definition at line 87 of file log.cc.

References EnvVarCheck(), ns3::GetComponentList(), and NS_FATAL_ERROR.

+ Here is the call graph for this function:

Member Function Documentation

void ns3::LogComponent::Disable ( const enum LogLevel  level)

Disable logging at level for this LogComponent.

Parameters
[in]levelthe LogLevel to disable.

Definition at line 270 of file log.cc.

References m_levels.

void ns3::LogComponent::Enable ( const enum LogLevel  level)

Enable this LogComponent at level

Parameters
[in]levelthe LogLevel to enable.

Definition at line 264 of file log.cc.

References m_levels, and m_mask.

Referenced by EnvVarCheck().

+ Here is the caller graph for this function:

void ns3::LogComponent::EnvVarCheck ( void  )
private

Parse the NS_LOG environment variable for options relating to this LogComponent.

Definition at line 107 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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string ns3::LogComponent::GetLevelLabel ( const enum LogLevel  level)
static

Get the string label for the given LogLevel.

Parameters
[in]levelthe LogLevel to get the label for.
Returns
the string label for level

Definition at line 283 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

Parameters
[in]levelthe level to check for.
Returns
true if level is enabled.

Definition at line 245 of file log.cc.

References m_levels.

bool ns3::LogComponent::IsNoneEnabled ( void  ) const

Check if all levels are disabled.

Returns
true if all levels are disabled.

Definition at line 252 of file log.cc.

References m_levels.

char const * ns3::LogComponent::Name ( void  ) const

Get the name of this LogComponent.

Returns
the name of this LogComponent.

Definition at line 276 of file log.cc.

References m_name.

void ns3::LogComponent::SetMask ( const enum LogLevel  level)

Prevent the enabling of a specific LogLevel.

Parameters
levelthe LogLevel to block

Definition at line 258 of file log.cc.

References m_mask.

Member Data Documentation

int32_t ns3::LogComponent::m_levels
private

Enabled LogLevels.

Definition at line 326 of file log.h.

Referenced by Disable(), Enable(), IsEnabled(), and IsNoneEnabled().

int32_t ns3::LogComponent::m_mask
private

Blocked LogLevels.

Definition at line 327 of file log.h.

Referenced by Enable(), and SetMask().

std::string ns3::LogComponent::m_name
private

LogComponent name.

Definition at line 328 of file log.h.

Referenced by EnvVarCheck(), and Name().


The documentation for this class was generated from the following files: