A Discrete-Event Network Simulator
API
ns3::LogComponent Class Reference

A single log component configuration. More...

#include "log.h"

+ Collaboration diagram for ns3::LogComponent:

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 ComponentListGetComponentList (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...
 

Detailed Description

A single log component configuration.

Definition at line 336 of file log.h.

Member Typedef Documentation

◆ ComponentList

typedef std::map<std::string, LogComponent *> ns3::LogComponent::ComponentList

LogComponent name map.

Internal:
This should really be considered an internal API. It is exposed here to allow print-introspected-doxygen.cc to generate a list of all LogComponents.

Definition at line 409 of file log.h.

Constructor & Destructor Documentation

◆ LogComponent()

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

Constructor.

Parameters
[in]nameThe user-visible name for this component.
[in]fileThe source code file which defined this LogComponent.
[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 107 of file log.cc.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ Disable()

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

Disable logging at level for this LogComponent.

Parameters
[in]levelThe LogLevel to disable.

Definition at line 307 of file log.cc.

References m_levels.

◆ Enable()

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

Enable this LogComponent at level.

Parameters
[in]levelThe LogLevel to enable.

Definition at line 301 of file log.cc.

References m_levels, and m_mask.

Referenced by EnvVarCheck().

+ Here is the caller graph for this function:

◆ EnvVarCheck()

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

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

Definition at line 145 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:

◆ File()

std::string ns3::LogComponent::File ( void  ) const

Get the compilation unit defining this LogComponent.

Returns
The file name.

Definition at line 319 of file log.cc.

References m_file.

◆ GetComponentList()

LogComponent::ComponentList * ns3::LogComponent::GetComponentList ( void  )
static

Get the list of LogComponnents.

Internal:
This should really be considered an internal API. It is exposed here to allow print-introspected-doxygen.cc to generate a list of all LogComponents.
Returns
The list of LogComponents.

Definition at line 75 of file log.cc.

Referenced by LogComponent(), ns3::ComponentExists(), ns3::GetLogComponent(), ns3::LogComponentDisable(), ns3::LogComponentDisableAll(), ns3::LogComponentEnable(), ns3::LogComponentEnableAll(), ns3::LogComponentPrintList(), and PrintAllLogComponents().

+ Here is the caller graph for this function:

◆ GetLevelLabel()

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 326 of file log.cc.

References ns3::LOG_DEBUG, ns3::LOG_ERROR, ns3::LOG_FUNCTION, ns3::LOG_INFO, ns3::LOG_LOGIC, and ns3::LOG_WARN.

◆ IsEnabled()

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 we are enabled at level.

Definition at line 282 of file log.cc.

References m_levels.

◆ IsNoneEnabled()

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

Check if all levels are disabled.

Returns
true if all levels are disabled.

Definition at line 289 of file log.cc.

References m_levels.

◆ Name()

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

Get the name of this LogComponent.

Returns
The name of this LogComponent.

Definition at line 313 of file log.cc.

References m_name.

◆ SetMask()

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

Prevent the enabling of a specific LogLevel.

Parameters
[in]levelThe LogLevel to block.

Definition at line 295 of file log.cc.

References m_mask.

Member Data Documentation

◆ m_file

std::string ns3::LogComponent::m_file
private

File defining this LogComponent.

Definition at line 433 of file log.h.

Referenced by File().

◆ m_levels

int32_t ns3::LogComponent::m_levels
private

Enabled LogLevels.

Definition at line 430 of file log.h.

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

◆ m_mask

int32_t ns3::LogComponent::m_mask
private

Blocked LogLevels.

Definition at line 431 of file log.h.

Referenced by Enable(), and SetMask().

◆ m_name

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

LogComponent name.

Definition at line 432 of file log.h.

Referenced by EnvVarCheck(), and Name().


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