205 #define NS_LOG_COMPONENT_DEFINE(name) \
206 static ns3::LogComponent g_log = ns3::LogComponent (name, __FILE__)
216 #define NS_LOG_COMPONENT_DEFINE_MASK(name, mask) \
217 static ns3::LogComponent g_log = ns3::LogComponent (name, __FILE__, mask)
228 #define NS_LOG_TEMPLATE_DECLARE LogComponent & g_log
239 #define NS_LOG_TEMPLATE_DEFINE(name) g_log (GetLogComponent (name))
249 #define NS_LOG_STATIC_TEMPLATE_DEFINE(name) \
250 [[maybe_unused]] static LogComponent & g_log = GetLogComponent (name)
257 #define NS_LOG_ERROR(msg) \
258 NS_LOG (ns3::LOG_ERROR, msg)
265 #define NS_LOG_WARN(msg) \
266 NS_LOG (ns3::LOG_WARN, msg)
273 #define NS_LOG_DEBUG(msg) \
274 NS_LOG (ns3::LOG_DEBUG, msg)
281 #define NS_LOG_INFO(msg) \
282 NS_LOG (ns3::LOG_INFO, msg)
289 #define NS_LOG_LOGIC(msg) \
290 NS_LOG (ns3::LOG_LOGIC, msg)
349 const std::string &
file,
381 char const *
Name (
void)
const;
386 std::string
File (
void)
const;
493 m_os <<
", " << param;
502 for (
auto i : vector)
516 ParameterLogger::operator<< <std::string> (
const std::string param);
525 ParameterLogger::operator<< <const char *> (
const char * param);
534 ParameterLogger::operator<< <int8_t> (int8_t param);
543 ParameterLogger::operator<< <uint8_t> (uint8_t param);
A single log component configuration.
void Enable(const enum LogLevel level)
Enable this LogComponent at level.
int32_t m_levels
Enabled LogLevels.
static std::string GetLevelLabel(const enum LogLevel level)
Get the string label for the given LogLevel.
static ComponentList * GetComponentList(void)
Get the list of LogComponnents.
void Disable(const enum LogLevel level)
Disable logging at level for this LogComponent.
bool IsNoneEnabled(void) const
Check if all levels are disabled.
std::string m_file
File defining this LogComponent.
std::string File(void) const
Get the compilation unit defining this LogComponent.
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.
std::map< std::string, LogComponent * > ComponentList
LogComponent name map.
char const * Name(void) const
Get the name of this LogComponent.
int32_t m_mask
Blocked LogLevels.
void EnvVarCheck(void)
Parse the NS_LOG environment variable for options relating to this LogComponent.
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.
bool m_first
First argument flag, doesn't get ,.
ParameterLogger & operator<<(T param)
Write a function parameter on the output stream, separating parameters after the first by ,...
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 LogComponentPrintList(void)
Print the list of logging messages available.
void(* TimePrinter)(std::ostream &os)
Function signature for features requiring a time formatter, such as logging or ShowProgress.
NodePrinter LogGetNodePrinter(void)
Get the LogNodePrinter function currently in use.
void(* NodePrinter)(std::ostream &os)
Function signature for prepending the node id to a log message.
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(void)
Get the LogTimePrinter function currently in use.
LogComponent & GetLogComponent(const std::string name)
Get the LogComponent registered with the given name.
void LogComponentDisable(char const *name, enum LogLevel level)
Disable the logging output associated with that log component.
void LogComponentEnable(char const *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 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.