202#define NS_LOG_COMPONENT_DEFINE(name) \
203 static ns3::LogComponent g_log = ns3::LogComponent(name, __FILE__)
213#define NS_LOG_COMPONENT_DEFINE_MASK(name, mask) \
214 static ns3::LogComponent g_log = ns3::LogComponent(name, __FILE__, mask)
225#define NS_LOG_TEMPLATE_DECLARE LogComponent& g_log
236#define NS_LOG_TEMPLATE_DEFINE(name) g_log(GetLogComponent(name))
246#define NS_LOG_STATIC_TEMPLATE_DEFINE(name) \
247 static LogComponent& g_log [[maybe_unused]] = GetLogComponent(name)
254#define NS_LOG_ERROR(msg) NS_LOG(ns3::LOG_ERROR, msg)
261#define NS_LOG_WARN(msg) NS_LOG(ns3::LOG_WARN, msg)
268#define NS_LOG_DEBUG(msg) NS_LOG(ns3::LOG_DEBUG, msg)
275#define NS_LOG_INFO(msg) NS_LOG(ns3::LOG_INFO, msg)
282#define NS_LOG_LOGIC(msg) NS_LOG(ns3::LOG_LOGIC, msg)
340 const std::string&
file,
372 const char*
Name()
const;
377 std::string
File()
const;
458 template <
typename T,
typename U = std::enable_if_t<std::is_arithmetic_v<T>>>
470 template <
typename T,
typename U = std::enable_if_t<!std::is_arithmetic_v<T>>>
479 template <
typename T>
498template <
typename T,
typename U>
507template <
typename T,
typename U>
520 for (
const auto& i : vector)
533ParameterLogger& ParameterLogger::operator<< <std::string>(
const std::string& param);
549ParameterLogger& ParameterLogger::operator<< <uint8_t>(
const uint8_t param);
A single log component configuration.
const char * Name() const
Get the name of this LogComponent.
static ComponentList * GetComponentList()
Get the list of LogComponnents.
void Enable(const enum LogLevel level)
Enable this LogComponent at level.
std::string File() const
Get the compilation unit defining this LogComponent.
int32_t m_levels
Enabled LogLevels.
static std::string GetLevelLabel(const enum LogLevel level)
Get the string label for the given LogLevel.
void EnvVarCheck()
Parse the NS_LOG environment variable for options relating to this LogComponent.
void Disable(const enum LogLevel level)
Disable logging at level for this LogComponent.
std::string m_file
File defining this LogComponent.
bool IsNoneEnabled() const
Check if all levels are disabled.
void SetMask(const enum LogLevel level)
Prevent the enabling of a specific LogLevel.
LogComponent(const std::string &name, const std::string &file, const enum LogLevel mask=LOG_NONE)
Constructor.
int32_t m_mask
Blocked LogLevels.
std::map< std::string, LogComponent * > ComponentList
LogComponent name map.
std::string m_name
LogComponent name.
bool IsEnabled(const enum LogLevel level) const
Check if this LogComponent is enabled for level.
Insert , when streaming function arguments.
ParameterLogger & operator<<(T param)
Write a function parameter on the output stream, separating parameters after the first by ,...
void CommaRest()
Add , before every parameter after the first.
bool m_first
First argument flag, doesn't get ,.
ParameterLogger(std::ostream &os)
Constructor.
std::ostream & m_os
Underlying output stream.
Definition of empty logging macros and the NS_LOG_NOOP_INTERNAL macro.
NS_LOG and related logging macro definitions.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentDisableAll(enum LogLevel level)
Disable all logging for all components.
void LogSetTimePrinter(TimePrinter printer)
Set the TimePrinter function to be used to prepend log messages with the simulation time.
void(* TimePrinter)(std::ostream &os)
Function signature for features requiring a time formatter, such as logging or ShowProgress.
void LogComponentDisable(const char *name, enum LogLevel level)
Disable the logging output associated with that log component.
void(* NodePrinter)(std::ostream &os)
Function signature for prepending the node id to a log message.
NodePrinter LogGetNodePrinter()
Get the LogNodePrinter function currently in use.
LogLevel
Logging severity classes and levels.
@ LOG_LEVEL_ALL
Print everything.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_LEVEL_LOGIC
LOG_LOGIC and above.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
@ LOG_FUNCTION
Function tracing.
@ LOG_ERROR
Serious error messages only.
@ LOG_WARN
Warning messages.
@ LOG_INFO
Informational messages (e.g., banners).
@ LOG_PREFIX_ALL
All prefixes.
@ LOG_LEVEL_FUNCTION
LOG_FUNCTION and above.
@ LOG_LEVEL_ERROR
LOG_ERROR and above.
@ LOG_ALL
Print everything.
@ LOG_LEVEL_WARN
LOG_WARN and above.
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
@ LOG_PREFIX_LEVEL
Prefix all trace prints with log level (severity).
@ LOG_LOGIC
Control flow tracing within functions.
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
@ LOG_LEVEL_INFO
LOG_INFO and above.
@ LOG_DEBUG
Rare ad-hoc debug messages.
TimePrinter LogGetTimePrinter()
Get the LogTimePrinter function currently in use.
LogComponent & GetLogComponent(const std::string name)
Get the LogComponent registered with the given name.
void LogComponentEnable(const char *name, enum LogLevel level)
Enable the logging output associated with that log component.
void LogSetNodePrinter(NodePrinter printer)
Set the LogNodePrinter function to be used to prepend log messages with the node id.
void LogComponentPrintList()
Print the list of logging messages available.
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components.
Declaration of ns3::NodePrinter function pointer type and ns3::DefaultNodePrinter function.
Declaration of ns3::TimePrinter function pointer type and ns3::DefaultTimePrinter function.