A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
log-line-test-example.cc File Reference
#include "ns3/command-line.h"
#include "ns3/core-module.h"
#include "ns3/nstime.h"
#include "ns3/simulator.h"
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <stdexcept>
#include <string>
Include dependency graph for log-line-test-example.cc:

Go to the source code of this file.

Classes

struct  Parameter
 A parameter whose operator<< optionally logs, then interrupts the program. More...

Macros

#define NS_LOG_APPEND_CONTEXT
 Append a label to each log line, as models do to identify the logging node.

Functions

void LogLines (bool nested, uint32_t count)
 Log three lines, the second one interrupted according to the mode.
std::ostream & operator<< (std::ostream &os, const Parameter &param)
 Stream a Parameter, logging and dying in the middle of the enclosing log line.

Variables

std::string g_label
 The label appended to every line by NS_LOG_APPEND_CONTEXT, when not empty.
std::string g_mode {"none"}
 How to interrupt the log line: none, Assertions, Fatal Error Handlers, throw or abort.

Macro Definition Documentation

◆ NS_LOG_APPEND_CONTEXT

#define NS_LOG_APPEND_CONTEXT
Value:
if (!g_label.empty()) \
{ \
ns3LogStream << "[" << g_label << "] "; \
}
std::string g_label
The label appended to every line by NS_LOG_APPEND_CONTEXT, when not empty.

Append a label to each log line, as models do to identify the logging node.

Definition at line 71 of file log-line-test-example.cc.

Variable Documentation

◆ g_label

std::string g_label

The label appended to every line by NS_LOG_APPEND_CONTEXT, when not empty.

Definition at line 67 of file log-line-test-example.cc.

◆ g_mode

std::string g_mode {"none"}

How to interrupt the log line: none, Assertions, Fatal Error Handlers, throw or abort.

Definition at line 64 of file log-line-test-example.cc.

Referenced by operator<<().