A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
log.cc File Reference

ns3::LogComponent and related implementations. More...

#include "log.h"
#include "assert.h"
#include "environment-variable.h"
#include "fatal-error.h"
#include "string.h"
#include <algorithm>
#include <ctype.h>
#include <iostream>
#include <map>
#include <memory>
#include <stdexcept>
#include <utility>
#include <vector>
#include <unistd.h>
Include dependency graph for log.cc:

Go to the source code of this file.

Classes

struct  ns3::anonymous_namespace{log.cc}::LogLine
 A memory buffer and the ostream assembling a log line into it. More...
class  ns3::anonymous_namespace{log.cc}::LogLineBuf
 A streambuf appending to a std::string whose capacity is reused between log lines, so steady-state logging does not allocate. More...
class  ns3::PrintList
 Handler for the undocumented print-list token in NS_LOG which triggers printing of the list of log components, then exits. More...

Namespaces

namespace  anonymous_namespace{log.cc}
 Unnamed namespace for log.cc.
namespace  ns3
 Every class exported by the ns3 library is enclosed in the ns3 namespace.
namespace  ns3::anonymous_namespace{log.cc}
 Unnamed namespace for log line assembly buffers.

Functions

static void ns3::CheckEnvironmentVariables ()
 Parse the NS_LOG environment variable.
static bool ns3::ComponentExists (std::string componentName)
 Check if a log component exists.
void ns3::anonymous_namespace{log.cc}::EmitLine (std::string &line)
 Write an assembled log line to std::clog, terminated by a newline, and empty it.
LogComponent & ns3::GetLogComponent (const std::string name)
 Get the LogComponent registered with the given name.
LogLine & ns3::anonymous_namespace{log.cc}::GetLogLine ()
void ns3::LogComponentDisable (const std::string &name, LogLevel level)
 Disable the logging output associated with that log component.
void ns3::LogComponentDisableAll (LogLevel level)
 Disable all logging for all components.
void ns3::LogComponentEnable (const std::string &name, LogLevel level)
 Enable the logging output associated with that log component.
void ns3::LogComponentEnableAll (LogLevel level)
 Enable the logging output for all registered log components.
void ns3::LogComponentPrintList ()
 Print the list of logging messages available.
NodePrinter ns3::LogGetNodePrinter ()
 Get the LogNodePrinter function currently in use.
TimePrinter ns3::LogGetTimePrinter ()
 Get the LogTimePrinter function currently in use.
std::ostream & ns3::LogLineBegin ()
 Begin assembling a log line in a reusable, thread-local memory buffer.
void ns3::LogLineCommit (std::ostream &os)
 Terminate a log line started with LogLineBegin().
void ns3::LogLineFlushPartial ()
 Emit the log line this thread is currently assembling, if any, without waiting for LogLineCommit().
void ns3::LogLineFlushPartialFromSignal ()
 Emit the log line this thread is currently assembling, if any, from a signal handler.
void ns3::LogSetNodePrinter (NodePrinter np)
 Set the LogNodePrinter function to be used to prepend log messages with the node id.
void ns3::LogSetTimePrinter (TimePrinter lp)
 Set the TimePrinter function to be used to prepend log messages with the simulation time.
void ns3::anonymous_namespace{log.cc}::WriteStdErr (const char *s, std::size_t n)
 Write to the standard error file descriptor, bypassing std::clog.

Variables

LogLine * ns3::anonymous_namespace{log.cc}::g_logLine = nullptr
 The thread's log line, once created.
bool ns3::anonymous_namespace{log.cc}::g_logLineDestroyed = false
 Whether this thread's LogLine has been destroyed.
static NodePrinter ns3::g_logNodePrinter = nullptr
 The Log NodePrinter.
static TimePrinter ns3::g_logTimePrinter = nullptr
 The Log TimePrinter.
static PrintList ns3::g_printList
 Invoke handler for print-list in NS_LOG environment variable.
const std::map< std::string, ns3::LogLevel > anonymous_namespace{log.cc}::LOG_LABEL_LEVELS
 Mapping of log level text names to values.
const std::map< ns3::LogLevel, std::string > anonymous_namespace{log.cc}::LOG_LEVEL_LABELS
 Inverse mapping of level values to log level text names.

Detailed Description

ns3::LogComponent and related implementations.

Definition in file log.cc.