|
|
| 23 |
|
23 |
|
| 24 |
#include <string> |
24 |
#include <string> |
| 25 |
#include <iostream> |
25 |
#include <iostream> |
|
|
26 |
|
| 27 |
namespace ns3 { |
| 28 |
|
| 29 |
enum LogLevel { |
| 30 |
LOG_NONE = 0x00000000, // no logging |
| 31 |
|
| 32 |
LOG_ERROR = 0x00000001, // serious error messages only |
| 33 |
LOG_LEVEL_ERROR = 0x00000001, |
| 34 |
|
| 35 |
LOG_WARN = 0x00000002, // warning messages |
| 36 |
LOG_LEVEL_WARN = 0x00000003, |
| 37 |
|
| 38 |
LOG_DEBUG = 0x00000004, // rare ad-hoc debug messages |
| 39 |
LOG_LEVEL_DEBUG = 0x00000007, |
| 40 |
|
| 41 |
LOG_INFO = 0x00000008, // informational messages (e.g., banners) |
| 42 |
LOG_LEVEL_INFO = 0x0000000f, |
| 43 |
|
| 44 |
LOG_FUNCTION = 0x00000010, // function tracing |
| 45 |
LOG_LEVEL_FUNCTION = 0x0000001f, |
| 46 |
|
| 47 |
LOG_LOGIC = 0x00000020, // control flow tracing within functions |
| 48 |
LOG_LEVEL_LOGIC = 0x0000003f, |
| 49 |
|
| 50 |
LOG_ALL = 0x3fffffff, // print everything |
| 51 |
LOG_LEVEL_ALL = LOG_ALL, |
| 52 |
|
| 53 |
LOG_PREFIX_FUNC = 0x80000000, // prefix all trace prints with function |
| 54 |
LOG_PREFIX_TIME = 0x40000000 // prefix all trace prints with simulation time |
| 55 |
}; |
| 56 |
|
| 57 |
/** |
| 58 |
* \param name a log component name |
| 59 |
* \param level a logging level |
| 60 |
* \ingroup logging |
| 61 |
* |
| 62 |
* Enable the logging output associated with that log component. |
| 63 |
* The logging output can be later disabled with a call |
| 64 |
* to ns3::LogComponentDisable. |
| 65 |
* |
| 66 |
* Same as running your program with the NS_LOG environment |
| 67 |
* variable set as NS_LOG='name=level' |
| 68 |
*/ |
| 69 |
void LogComponentEnable (char const *name, enum LogLevel level); |
| 70 |
|
| 71 |
/** |
| 72 |
* \param level a logging level |
| 73 |
* \ingroup logging |
| 74 |
* |
| 75 |
* Enable the logging output for all registered log components. |
| 76 |
* |
| 77 |
* Same as running your program with the NS_LOG environment |
| 78 |
* variable set as NS_LOG='*=level' |
| 79 |
*/ |
| 80 |
void LogComponentEnableAll (enum LogLevel level); |
| 81 |
|
| 82 |
|
| 83 |
/** |
| 84 |
* \param name a log component name |
| 85 |
* \param level a logging level |
| 86 |
* \ingroup logging |
| 87 |
* |
| 88 |
* Disable the logging output associated with that log component. |
| 89 |
* The logging output can be later re-enabled with a call |
| 90 |
* to ns3::LogComponentEnable. |
| 91 |
*/ |
| 92 |
void LogComponentDisable (char const *name, enum LogLevel level); |
| 93 |
|
| 94 |
/** |
| 95 |
* \param level a logging level |
| 96 |
* \ingroup logging |
| 97 |
* |
| 98 |
* Disable all logging for all components. |
| 99 |
*/ |
| 100 |
void LogComponentDisableAll (enum LogLevel level); |
| 101 |
|
| 102 |
|
| 103 |
} // namespace ns3 |
| 104 |
|
| 26 |
|
105 |
|
| 27 |
#ifdef NS3_LOG_ENABLE |
106 |
#ifdef NS3_LOG_ENABLE |
| 28 |
|
107 |
|
|
|
| 230 |
|
309 |
|
| 231 |
namespace ns3 { |
310 |
namespace ns3 { |
| 232 |
|
311 |
|
| 233 |
enum LogLevel { |
|
|
| 234 |
LOG_NONE = 0x00000000, // no logging |
| 235 |
|
| 236 |
LOG_ERROR = 0x00000001, // serious error messages only |
| 237 |
LOG_LEVEL_ERROR = 0x00000001, |
| 238 |
|
| 239 |
LOG_WARN = 0x00000002, // warning messages |
| 240 |
LOG_LEVEL_WARN = 0x00000003, |
| 241 |
|
| 242 |
LOG_DEBUG = 0x00000004, // rare ad-hoc debug messages |
| 243 |
LOG_LEVEL_DEBUG = 0x00000007, |
| 244 |
|
| 245 |
LOG_INFO = 0x00000008, // informational messages (e.g., banners) |
| 246 |
LOG_LEVEL_INFO = 0x0000000f, |
| 247 |
|
| 248 |
LOG_FUNCTION = 0x00000010, // function tracing |
| 249 |
LOG_LEVEL_FUNCTION = 0x0000001f, |
| 250 |
|
| 251 |
LOG_LOGIC = 0x00000020, // control flow tracing within functions |
| 252 |
LOG_LEVEL_LOGIC = 0x0000003f, |
| 253 |
|
| 254 |
LOG_ALL = 0x3fffffff, // print everything |
| 255 |
LOG_LEVEL_ALL = LOG_ALL, |
| 256 |
|
| 257 |
LOG_PREFIX_FUNC = 0x80000000, // prefix all trace prints with function |
| 258 |
LOG_PREFIX_TIME = 0x40000000 // prefix all trace prints with simulation time |
| 259 |
}; |
| 260 |
|
| 261 |
/** |
| 262 |
* \param name a log component name |
| 263 |
* \param level a logging level |
| 264 |
* \ingroup logging |
| 265 |
* |
| 266 |
* Enable the logging output associated with that log component. |
| 267 |
* The logging output can be later disabled with a call |
| 268 |
* to ns3::LogComponentDisable. |
| 269 |
* |
| 270 |
* Same as running your program with the NS_LOG environment |
| 271 |
* variable set as NS_LOG='name=level' |
| 272 |
*/ |
| 273 |
void LogComponentEnable (char const *name, enum LogLevel level); |
| 274 |
|
| 275 |
/** |
| 276 |
* \param level a logging level |
| 277 |
* \ingroup logging |
| 278 |
* |
| 279 |
* Enable the logging output for all registered log components. |
| 280 |
* |
| 281 |
* Same as running your program with the NS_LOG environment |
| 282 |
* variable set as NS_LOG='*=level' |
| 283 |
*/ |
| 284 |
void LogComponentEnableAll (enum LogLevel level); |
| 285 |
|
| 286 |
|
| 287 |
/** |
| 288 |
* \param name a log component name |
| 289 |
* \param level a logging level |
| 290 |
* \ingroup logging |
| 291 |
* |
| 292 |
* Disable the logging output associated with that log component. |
| 293 |
* The logging output can be later re-enabled with a call |
| 294 |
* to ns3::LogComponentEnable. |
| 295 |
*/ |
| 296 |
void LogComponentDisable (char const *name, enum LogLevel level); |
| 297 |
|
| 298 |
/** |
| 299 |
* \param level a logging level |
| 300 |
* \ingroup logging |
| 301 |
* |
| 302 |
* Disable all logging for all components. |
| 303 |
*/ |
| 304 |
void LogComponentDisableAll (enum LogLevel level); |
| 305 |
|
| 306 |
|
312 |
|
| 307 |
/** |
313 |
/** |
| 308 |
* \ingroup logging |
314 |
* \ingroup logging |
|
|
| 373 |
#define NS_LOG_UNCOND(msg) |
379 |
#define NS_LOG_UNCOND(msg) |
| 374 |
|
380 |
|
| 375 |
#define LogComponentPrintList |
381 |
#define LogComponentPrintList |
| 376 |
#define LogComponentEnable(name,level) |
|
|
| 377 |
#define LogComponentDisable(name,level) |
| 378 |
#define LogComponentEnableAll(level) |
| 379 |
#define LogComponentDisableAll(level) |
| 380 |
#define LogRegisterTimePrinter(printer) |
382 |
#define LogRegisterTimePrinter(printer) |
| 381 |
|
383 |
|
| 382 |
#define LogSetTimePrinter(printer) |
384 |
#define LogSetTimePrinter(printer) |