A Discrete-Event Network Simulator
API
log.h File Reference

Debug message logging. More...

#include <string>
#include <iostream>
#include <stdint.h>
#include <map>
#include <type_traits>
#include <vector>
#include "node-printer.h"
#include "time-printer.h"
#include "log-macros-enabled.h"
#include "log-macros-disabled.h"
+ Include dependency graph for log.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ns3::LogComponent
 A single log component configuration. More...
 
class  ns3::ParameterLogger
 Insert , when streaming function arguments. More...
 

Namespaces

namespace  ns3
 Every class exported by the ns3 library is enclosed in the ns3 namespace.
 

Macros

#define NS_LOG_COMPONENT_DEFINE(name)    static ns3::LogComponent g_log = ns3::LogComponent (name, __FILE__)
 Define a Log component with a specific name. More...
 
#define NS_LOG_COMPONENT_DEFINE_MASK(name, mask)    static ns3::LogComponent g_log = ns3::LogComponent (name, __FILE__, mask)
 Define a logging component with a mask. More...
 
#define NS_LOG_DEBUG(msg)    NS_LOG (ns3::LOG_DEBUG, msg)
 Use NS_LOG to output a message of level LOG_DEBUG. More...
 
#define NS_LOG_ERROR(msg)    NS_LOG (ns3::LOG_ERROR, msg)
 Use NS_LOG to output a message of level LOG_ERROR. More...
 
#define NS_LOG_INFO(msg)    NS_LOG (ns3::LOG_INFO, msg)
 Use NS_LOG to output a message of level LOG_INFO. More...
 
#define NS_LOG_LOGIC(msg)    NS_LOG (ns3::LOG_LOGIC, msg)
 Use NS_LOG to output a message of level LOG_LOGIC. More...
 
#define NS_LOG_STATIC_TEMPLATE_DEFINE(name)    [[maybe_unused]] static LogComponent & g_log = GetLogComponent (name)
 Declare and initialize a reference to a Log component. More...
 
#define NS_LOG_TEMPLATE_DECLARE   LogComponent & g_log
 Declare a reference to a Log component. More...
 
#define NS_LOG_TEMPLATE_DEFINE(name)   g_log (GetLogComponent (name))
 Initialize a reference to a Log component. More...
 
#define NS_LOG_WARN(msg)    NS_LOG (ns3::LOG_WARN, msg)
 Use NS_LOG to output a message of level LOG_WARN. More...
 

Enumerations

enum  ns3::LogLevel {
  ns3::LOG_NONE = 0x00000000 , ns3::LOG_ERROR = 0x00000001 , ns3::LOG_LEVEL_ERROR = 0x00000001 , ns3::LOG_WARN = 0x00000002 ,
  ns3::LOG_LEVEL_WARN = 0x00000003 , ns3::LOG_DEBUG = 0x00000004 , ns3::LOG_LEVEL_DEBUG = 0x00000007 , ns3::LOG_INFO = 0x00000008 ,
  ns3::LOG_LEVEL_INFO = 0x0000000f , ns3::LOG_FUNCTION = 0x00000010 , ns3::LOG_LEVEL_FUNCTION = 0x0000001f , ns3::LOG_LOGIC = 0x00000020 ,
  ns3::LOG_LEVEL_LOGIC = 0x0000003f , ns3::LOG_ALL = 0x0fffffff , ns3::LOG_LEVEL_ALL = LOG_ALL , ns3::LOG_PREFIX_FUNC = 0x80000000 ,
  ns3::LOG_PREFIX_TIME = 0x40000000 , ns3::LOG_PREFIX_NODE = 0x20000000 , ns3::LOG_PREFIX_LEVEL = 0x10000000 , ns3::LOG_PREFIX_ALL = 0xf0000000
}
 Logging severity classes and levels. More...
 

Functions

LogComponent & ns3::GetLogComponent (const std::string name)
 Get the LogComponent registered with the given name. More...
 
void ns3::LogComponentDisable (char const *name, enum LogLevel level)
 Disable the logging output associated with that log component. More...
 
void ns3::LogComponentDisableAll (enum LogLevel level)
 Disable all logging for all components. More...
 
void ns3::LogComponentEnable (char const *name, enum LogLevel level)
 Enable the logging output associated with that log component. More...
 
void ns3::LogComponentEnableAll (enum LogLevel level)
 Enable the logging output for all registered log components. More...
 
void ns3::LogComponentPrintList (void)
 Print the list of logging messages available. More...
 
NodePrinter ns3::LogGetNodePrinter (void)
 Get the LogNodePrinter function currently in use. More...
 
TimePrinter ns3::LogGetTimePrinter (void)
 Get the LogTimePrinter function currently in use. More...
 
void ns3::LogSetNodePrinter (NodePrinter np)
 Set the LogNodePrinter function to be used to prepend log messages with the node id. More...
 
void ns3::LogSetTimePrinter (TimePrinter lp)
 Set the TimePrinter function to be used to prepend log messages with the simulation time. More...
 
template<>
ParameterLogger & ns3::ParameterLogger::operator<<< std::string > (const std::string &param)
 Specialization for strings. More...
 

Detailed Description

Debug message logging.

Definition in file log.h.