Mercurial > hg > freeDiameter
comparison include/freeDiameter/libfdproto.h @ 1407:d4a4ab5239c7
add log level FD_LOG_INFO
Add log level FD_LOG_INFO, below FD_LOG_NOTICE and above FD_LOG_DEBUG.
author | Luke Mewburn <luke@mewburn.net> |
---|---|
date | Tue, 18 Feb 2020 17:01:07 +1100 |
parents | 357e9cec520f |
children | f6f12521c2aa |
comparison
equal
deleted
inserted
replaced
1406:deaa89f4a994 | 1407:d4a4ab5239c7 |
---|---|
268 #endif /* ASSERT */ | 268 #endif /* ASSERT */ |
269 | 269 |
270 /* log levels definitions, that are passed to the logger */ | 270 /* log levels definitions, that are passed to the logger */ |
271 #define FD_LOG_ANNOYING 0 /* very verbose loops and such "overkill" traces. Only active when the framework is compiled in DEBUG mode. */ | 271 #define FD_LOG_ANNOYING 0 /* very verbose loops and such "overkill" traces. Only active when the framework is compiled in DEBUG mode. */ |
272 #define FD_LOG_DEBUG 1 /* Get a detailed sense of what is going on in the framework. Use this level for normal debug */ | 272 #define FD_LOG_DEBUG 1 /* Get a detailed sense of what is going on in the framework. Use this level for normal debug */ |
273 #define FD_LOG_INFO 2 /* Informational execution states */ | |
273 #define FD_LOG_NOTICE 3 /* Normal execution states worth noting */ | 274 #define FD_LOG_NOTICE 3 /* Normal execution states worth noting */ |
274 #define FD_LOG_ERROR 5 /* Recoverable or expected error conditions */ | 275 #define FD_LOG_ERROR 5 /* Recoverable or expected error conditions */ |
275 #define FD_LOG_FATAL 6 /* Unrecoverable error, e.g. malloc fail, etc. that requires the framework to shutdown */ | 276 #define FD_LOG_FATAL 6 /* Unrecoverable error, e.g. malloc fail, etc. that requires the framework to shutdown */ |
276 | 277 |
277 /* The level used by the default logger, can be changed by command-line arguments. Ignored for other loggers. */ | 278 /* The level used by the default logger, can be changed by command-line arguments. Ignored for other loggers. */ |
327 #endif /* DEBUG */ | 328 #endif /* DEBUG */ |
328 | 329 |
329 /* Debug information useful to follow in detail what is going on */ | 330 /* Debug information useful to follow in detail what is going on */ |
330 #define LOG_D(format,args... ) \ | 331 #define LOG_D(format,args... ) \ |
331 LOG(FD_LOG_DEBUG, format, ##args) | 332 LOG(FD_LOG_DEBUG, format, ##args) |
333 | |
334 /* Report an info message */ | |
335 #define LOG_I(format,args... ) \ | |
336 LOG(FD_LOG_INFO, format,##args) | |
332 | 337 |
333 /* Report a normal message that is useful for normal admin monitoring */ | 338 /* Report a normal message that is useful for normal admin monitoring */ |
334 #define LOG_N(format,args... ) \ | 339 #define LOG_N(format,args... ) \ |
335 LOG(FD_LOG_NOTICE, format,##args) | 340 LOG(FD_LOG_NOTICE, format,##args) |
336 | 341 |
514 /* old macro for traces. To be replaced by appropriate LOG_* macros. */ | 519 /* old macro for traces. To be replaced by appropriate LOG_* macros. */ |
515 # define TRACE_DEBUG(oldlevel, format,args... ) { \ | 520 # define TRACE_DEBUG(oldlevel, format,args... ) { \ |
516 int __l__; \ | 521 int __l__; \ |
517 if ((__l__ = TRACE_BOOL(oldlevel))) { \ | 522 if ((__l__ = TRACE_BOOL(oldlevel))) { \ |
518 if (oldlevel <= NONE) { LOG_E(format,##args); } \ | 523 if (oldlevel <= NONE) { LOG_E(format,##args); } \ |
519 else if (oldlevel <= INFO) { LOG_N(format,##args); } \ | 524 else if (oldlevel <= INFO) { LOG_I(format,##args); } \ |
520 else if (__l__ == 2) { LOG_N(format,##args); } \ | 525 else if (__l__ == 2) { LOG_N(format,##args); } \ |
521 else if (oldlevel <= FULL) { LOG_D(format,##args); } \ | 526 else if (oldlevel <= FULL) { LOG_D(format,##args); } \ |
522 else { LOG_A(format,##args); } \ | 527 else { LOG_A(format,##args); } \ |
523 } } | 528 } } |
524 | 529 |
593 /*============================================================*/ | 598 /*============================================================*/ |
594 /* Optimized code: remove all debugging code */ | 599 /* Optimized code: remove all debugging code */ |
595 /*============================================================*/ | 600 /*============================================================*/ |
596 #ifdef STRIP_DEBUG_CODE | 601 #ifdef STRIP_DEBUG_CODE |
597 #undef LOG_D | 602 #undef LOG_D |
603 #undef LOG_I | |
598 #undef LOG_N | 604 #undef LOG_N |
599 #undef LOG_E | 605 #undef LOG_E |
600 #undef LOG_F | 606 #undef LOG_F |
601 #undef LOG_BUFFER | 607 #undef LOG_BUFFER |
602 | 608 |
603 #define LOG_D(format,args... ) /* noop */ | 609 #define LOG_D(format,args... ) /* noop */ |
610 #define LOG_I(format,args...) fd_log(FD_LOG_INFO, format, ## args) | |
604 #define LOG_N(format,args...) fd_log(FD_LOG_NOTICE, format, ## args) | 611 #define LOG_N(format,args...) fd_log(FD_LOG_NOTICE, format, ## args) |
605 #define LOG_E(format,args...) fd_log(FD_LOG_ERROR, format, ## args) | 612 #define LOG_E(format,args...) fd_log(FD_LOG_ERROR, format, ## args) |
606 #define LOG_F(format,args...) fd_log(FD_LOG_FATAL, format, ## args) | 613 #define LOG_F(format,args...) fd_log(FD_LOG_FATAL, format, ## args) |
607 #define LOG_BUFFER(printlevel, level, prefix, buf, bufsz, suffix ) { \ | 614 #define LOG_BUFFER(printlevel, level, prefix, buf, bufsz, suffix ) { \ |
608 if (printlevel > FD_LOG_DEBUG) { \ | 615 if (printlevel > FD_LOG_DEBUG) { \ |