changeset 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 deaa89f4a994
children 23e224d22f45
files freeDiameterd/main.c include/freeDiameter/libfdproto.h libfdproto/log.c
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/freeDiameterd/main.c	Tue Feb 18 16:48:26 2020 +1100
+++ b/freeDiameterd/main.c	Tue Feb 18 17:01:07 2020 +1100
@@ -68,6 +68,9 @@
 	int level;
 
 	switch (loglevel) {
+	case FD_LOG_INFO:
+		level = LOG_INFO;
+		break;
 	case FD_LOG_NOTICE:
 		level = LOG_NOTICE;
 		break;
--- a/include/freeDiameter/libfdproto.h	Tue Feb 18 16:48:26 2020 +1100
+++ b/include/freeDiameter/libfdproto.h	Tue Feb 18 17:01:07 2020 +1100
@@ -270,6 +270,7 @@
 /* log levels definitions, that are passed to the logger */
 #define FD_LOG_ANNOYING  0  /* very verbose loops and such "overkill" traces. Only active when the framework is compiled in DEBUG mode. */
 #define FD_LOG_DEBUG     1  /* Get a detailed sense of what is going on in the framework. Use this level for normal debug */
+#define FD_LOG_INFO      2  /* Informational execution states */
 #define FD_LOG_NOTICE    3  /* Normal execution states worth noting */
 #define FD_LOG_ERROR     5  /* Recoverable or expected error conditions */
 #define FD_LOG_FATAL     6  /* Unrecoverable error, e.g. malloc fail, etc. that requires the framework to shutdown */
@@ -330,6 +331,10 @@
 #define LOG_D(format,args... ) \
 		LOG(FD_LOG_DEBUG, format, ##args)
 
+/* Report an info message */
+#define LOG_I(format,args... ) \
+		LOG(FD_LOG_INFO, format,##args)
+
 /* Report a normal message that is useful for normal admin monitoring */
 #define LOG_N(format,args... ) \
 		LOG(FD_LOG_NOTICE, format,##args)
@@ -516,7 +521,7 @@
 		int __l__;								\
 		if ((__l__ = TRACE_BOOL(oldlevel))) {					\
 			if      (oldlevel <= NONE) { LOG_E(format,##args); }		\
-			else if (oldlevel <= INFO) { LOG_N(format,##args); }		\
+			else if (oldlevel <= INFO) { LOG_I(format,##args); }		\
 			else if (__l__ == 2)       { LOG_N(format,##args); }		\
 			else if (oldlevel <= FULL) { LOG_D(format,##args); }		\
 			else                       { LOG_A(format,##args); }		\
@@ -595,12 +600,14 @@
 /*============================================================*/
 #ifdef STRIP_DEBUG_CODE
 #undef LOG_D
+#undef LOG_I
 #undef LOG_N
 #undef LOG_E
 #undef LOG_F
 #undef LOG_BUFFER
 
 #define LOG_D(format,args... ) /* noop */
+#define LOG_I(format,args...) fd_log(FD_LOG_INFO, format, ## args)
 #define LOG_N(format,args...) fd_log(FD_LOG_NOTICE, format, ## args)
 #define LOG_E(format,args...) fd_log(FD_LOG_ERROR, format, ## args)
 #define LOG_F(format,args...) fd_log(FD_LOG_FATAL, format, ## args)
--- a/libfdproto/log.c	Tue Feb 18 16:48:26 2020 +1100
+++ b/libfdproto/log.c	Tue Feb 18 17:01:07 2020 +1100
@@ -112,6 +112,7 @@
     switch(printlevel) {
 	    case FD_LOG_ANNOYING:  printf("%s	A   ", (use_colors == 1) ? "\e[0;37m" : ""); break;
 	    case FD_LOG_DEBUG:     printf("%s DBG   ", (use_colors == 1) ? "\e[0;37m" : ""); break;
+	    case FD_LOG_INFO:      printf("%sINFO   ", (use_colors == 1) ? "\e[1;37m" : ""); break;
 	    case FD_LOG_NOTICE:    printf("%sNOTI   ", (use_colors == 1) ? "\e[1;37m" : ""); break;
 	    case FD_LOG_ERROR:     printf("%sERROR  ", (use_colors == 1) ? "\e[0;31m" : ""); break;
 	    case FD_LOG_FATAL:     printf("%sFATAL! ", (use_colors == 1) ? "\e[0;31m" : ""); break;
"Welcome to our mercurial repository"