View | Details | Raw Unified | Return to bug 258
Collapse All | Expand All

(-)a/src/core/log.cc (-2 / +32 lines)
 Lines 17-29    Link Here 
17
 *
17
 *
18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
 */
19
 */
20
#include "log.h"
20
21
21
#ifdef NS3_LOG_ENABLE
22
#ifdef NS3_LOG_ENABLE
22
23
23
#include <list>
24
#include <list>
24
#include <utility>
25
#include <utility>
25
#include <iostream>
26
#include <iostream>
26
#include "log.h"
27
#include "assert.h"
27
#include "assert.h"
28
#include "ns3/core-config.h"
28
#include "ns3/core-config.h"
29
#include "fatal-error.h"
29
#include "fatal-error.h"
 Lines 368-371    Link Here 
368
368
369
} // namespace ns3
369
} // namespace ns3
370
370
371
#endif // NS3_LOG_ENABLE
371
#else // NS3_LOG_ENABLE
372
373
namespace ns3 {
374
375
void 
376
LogComponentEnable (char const *name, enum LogLevel level)
377
{
378
379
}
380
381
void 
382
LogComponentEnableAll (enum LogLevel level)
383
{
384
385
}
386
387
void 
388
LogComponentDisable (char const *name, enum LogLevel level)
389
{
390
391
}
392
393
void 
394
LogComponentDisableAll (enum LogLevel level)
395
{
396
397
}
398
399
} // namespace ns3
400
401
#endif
(-)a/src/core/log.h (-77 / +79 lines)
 Lines 23-28    Link Here 
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
 Lines 230-308    Link Here 
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
 Lines 373-382    Link Here 
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)

Return to bug 258