|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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 static LogComponent & NS_UNUSED_GLOBAL (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);
void LogSetTimePrinter(TimePrinter printer)
Set the TimePrinter function to be used to prepend log messages with the simulation time.
@ LOG_LEVEL_ERROR
LOG_ERROR and above.
@ LOG_ERROR
Serious error messages only.
@ LOG_LEVEL_INFO
LOG_INFO and above.
@ LOG_FUNCTION
Function tracing.
LogComponent & GetLogComponent(const std::string name)
Get the LogComponent registered with the given name.
@ LOG_LEVEL_FUNCTION
LOG_FUNCTION and above.
bool IsNoneEnabled(void) const
Check if all levels are disabled.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentDisable(char const *name, enum LogLevel level)
Disable the logging output associated with that log component.
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
static std::string GetLevelLabel(const enum LogLevel level)
Get the string label for the given LogLevel.
@ LOG_ALL
Print everything.
@ LOG_LEVEL_ALL
Print everything.
@ LOG_LEVEL_WARN
LOG_WARN and above.
ParameterLogger & operator<<(T param)
Write a function parameter on the output stream, separating parameters after the first by ,...
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components.
ParameterLogger(std::ostream &os)
Constructor.
void EnvVarCheck(void)
Parse the NS_LOG environment variable for options relating to this LogComponent.
void LogSetNodePrinter(NodePrinter printer)
Set the LogNodePrinter function to be used to prepend log messages with the node id.
bool m_first
First argument flag, doesn't get ,.
void Disable(const enum LogLevel level)
Disable logging at level for this LogComponent.
Declaration of ns3::TimePrinter function pointer type and ns3::DefaultTimePrinter function.
Declaration of ns3::NodePrinter function pointer type and ns3::DefaultNodePrinter function.
NodePrinter LogGetNodePrinter(void)
Get the LogNodePrinter function currently in use.
void Enable(const enum LogLevel level)
Enable this LogComponent at level.
@ LOG_PREFIX_LEVEL
Prefix all trace prints with log level (severity).
std::map< std::string, LogComponent * > ComponentList
LogComponent name map.
std::ostream & m_os
Underlying output stream.
TimePrinter LogGetTimePrinter(void)
Get the LogTimePrinter function currently in use.
static ComponentList * GetComponentList(void)
Get the list of LogComponnents.
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
NS_LOG and related logging macro definitions.
bool IsEnabled(const enum LogLevel level) const
Check if this LogComponent is enabled for level.
@ LOG_LOGIC
Control flow tracing within functions.
std::string m_file
File defining this LogComponent.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_PREFIX_ALL
All prefixes.
void(* NodePrinter)(std::ostream &os)
Function signature for prepending the node id to a log message.
LogLevel
Logging severity classes and levels.
Insert , when streaming function arguments.
void(* TimePrinter)(std::ostream &os)
Function signature for features requiring a time formatter, such as logging or ShowProgress.
LogComponent(const std::string &name, const std::string &file, const enum LogLevel mask=LOG_NONE)
Constructor.
A single log component configuration.
int32_t m_mask
Blocked LogLevels.
int32_t m_levels
Enabled LogLevels.
@ LOG_WARN
Warning messages.
void LogComponentPrintList(void)
Print the list of logging messages available.
std::string m_name
LogComponent name.
@ LOG_DEBUG
Rare ad-hoc debug messages.
void SetMask(const enum LogLevel level)
Prevent the enabling of a specific LogLevel.
std::string File(void) const
Get the compilation unit defining this LogComponent.
Definition of empty logging macros and the NS_LOG_NOOP_INTERNAL macro.
@ LOG_LEVEL_LOGIC
LOG_LOGIC and above.
char const * Name(void) const
Get the name of this LogComponent.
void LogComponentDisableAll(enum LogLevel level)
Disable all logging for all components.
@ LOG_INFO
Informational messages (e.g., banners).