A Discrete-Event Network Simulator
API
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ns3::LogComponent Class Reference

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 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 344 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 417 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 114 of file log.cc.

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

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

References m_levels, and m_mask.

Referenced by EnvVarCheck().

◆ EnvVarCheck()

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

◆ File()

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

Get the compilation unit defining this LogComponent.

Returns
The file name.

Definition at line 327 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 80 of file log.cc.

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

◆ 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 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.

◆ 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 290 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 297 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 321 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 303 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 442 of file log.h.

Referenced by File().

◆ m_levels

int32_t ns3::LogComponent::m_levels
private

Enabled LogLevels.

Definition at line 439 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 440 of file log.h.

Referenced by Enable(), and SetMask().

◆ m_name

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

LogComponent name.

Definition at line 441 of file log.h.

Referenced by EnvVarCheck(), and Name().


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