|
|
| 24 |
#include <string> |
24 |
#include <string> |
| 25 |
#include <iostream> |
25 |
#include <iostream> |
| 26 |
#include <stdint.h> |
26 |
#include <stdint.h> |
|
|
27 |
#include <map> |
| 27 |
|
28 |
|
| 28 |
namespace ns3 { |
29 |
namespace ns3 { |
| 29 |
|
30 |
|
|
|
| 48 |
LOG_LOGIC = 0x00000020, // control flow tracing within functions |
49 |
LOG_LOGIC = 0x00000020, // control flow tracing within functions |
| 49 |
LOG_LEVEL_LOGIC = 0x0000003f, |
50 |
LOG_LEVEL_LOGIC = 0x0000003f, |
| 50 |
|
51 |
|
| 51 |
LOG_ALL = 0x1fffffff, // print everything |
52 |
LOG_ALL = 0x0fffffff, // print everything |
| 52 |
LOG_LEVEL_ALL = LOG_ALL, |
53 |
LOG_LEVEL_ALL = LOG_ALL, |
| 53 |
|
54 |
|
| 54 |
LOG_PREFIX_FUNC = 0x80000000, // prefix all trace prints with function |
55 |
LOG_PREFIX_FUNC = 0x80000000, // prefix all trace prints with function |
| 55 |
LOG_PREFIX_TIME = 0x40000000, // prefix all trace prints with simulation time |
56 |
LOG_PREFIX_TIME = 0x40000000, // prefix all trace prints with simulation time |
| 56 |
LOG_PREFIX_NODE = 0x20000000 // prefix all trace prints with simulation node |
57 |
LOG_PREFIX_NODE = 0x20000000, // prefix all trace prints with simulation node |
|
|
58 |
LOG_PREFIX_LEVEL = 0x10000000 // prefix all trace prints with log level (severity) |
| 57 |
}; |
59 |
}; |
| 58 |
|
60 |
|
| 59 |
/** |
61 |
/** |
|
|
| 148 |
__FUNCTION__ << "(): "; \ |
150 |
__FUNCTION__ << "(): "; \ |
| 149 |
} \ |
151 |
} \ |
| 150 |
|
152 |
|
|
|
153 |
#define NS_LOG_APPEND_LEVEL_PREFIX(level) \ |
| 154 |
if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL)) \ |
| 155 |
{ \ |
| 156 |
std::clog << "[" << g_log.GetLevelLabel (level) << "] "; \ |
| 157 |
} \ |
| 158 |
|
| 159 |
|
| 151 |
#ifndef NS_LOG_APPEND_CONTEXT |
160 |
#ifndef NS_LOG_APPEND_CONTEXT |
| 152 |
#define NS_LOG_APPEND_CONTEXT |
161 |
#define NS_LOG_APPEND_CONTEXT |
| 153 |
#endif /* NS_LOG_APPEND_CONTEXT */ |
162 |
#endif /* NS_LOG_APPEND_CONTEXT */ |
|
|
| 212 |
NS_LOG_APPEND_NODE_PREFIX; \ |
221 |
NS_LOG_APPEND_NODE_PREFIX; \ |
| 213 |
NS_LOG_APPEND_CONTEXT; \ |
222 |
NS_LOG_APPEND_CONTEXT; \ |
| 214 |
NS_LOG_APPEND_FUNC_PREFIX; \ |
223 |
NS_LOG_APPEND_FUNC_PREFIX; \ |
|
|
224 |
NS_LOG_APPEND_LEVEL_PREFIX (level); \ |
| 215 |
std::clog << msg << std::endl; \ |
225 |
std::clog << msg << std::endl; \ |
| 216 |
} \ |
226 |
} \ |
| 217 |
} \ |
227 |
} \ |
|
|
| 380 |
void Enable (enum LogLevel level); |
390 |
void Enable (enum LogLevel level); |
| 381 |
void Disable (enum LogLevel level); |
391 |
void Disable (enum LogLevel level); |
| 382 |
char const *Name (void) const; |
392 |
char const *Name (void) const; |
|
|
393 |
std::string GetLevelLabel(const enum LogLevel level) const; |
| 383 |
private: |
394 |
private: |
|
|
395 |
std::map<enum LogLevel, std::string> LevelLabels() const; |
| 384 |
int32_t m_levels; |
396 |
int32_t m_levels; |
| 385 |
char const *m_name; |
397 |
char const *m_name; |
| 386 |
}; |
398 |
}; |