]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
logger: Add unique verbose prefixes for levels 5-10.
authorNaveen Albert <asterisk@phreaknet.org>
Sat, 27 Apr 2024 15:06:47 +0000 (11:06 -0400)
committerNaveen Albert <asterisk@phreaknet.org>
Tue, 30 Apr 2024 19:28:00 +0000 (19:28 +0000)
Add unique verbose prefixes for levels higher than 4, so
that these can be visually differentiated from each other.

Resolves: #721

include/asterisk/logger.h
main/asterisk.c
main/logger.c

index 0c4faea844bbbfb23ba346a5ebe07e60f79277fd..ef7a6a1e1d82c4052d39757ddfe11171aa8178da 100644 (file)
@@ -41,10 +41,16 @@ extern "C" {
 
 #define _A_ __FILE__, __LINE__, __FUNCTION__
 
-#define VERBOSE_PREFIX_1 " "
-#define VERBOSE_PREFIX_2 "  == "
-#define VERBOSE_PREFIX_3 "    -- "
-#define VERBOSE_PREFIX_4 "       > "
+#define VERBOSE_PREFIX_1  " "
+#define VERBOSE_PREFIX_2  "  == "
+#define VERBOSE_PREFIX_3  "    -- "
+#define VERBOSE_PREFIX_4  "       > "
+#define VERBOSE_PREFIX_5  "        > "
+#define VERBOSE_PREFIX_6  "         > "
+#define VERBOSE_PREFIX_7  "          > "
+#define VERBOSE_PREFIX_8  "           > "
+#define VERBOSE_PREFIX_9  "            > "
+#define VERBOSE_PREFIX_10 "             > "
 
 #define AST_CALLID_BUFFER_LENGTH 13
 
@@ -161,7 +167,7 @@ void __attribute__((format(printf, 5, 6))) ast_queue_log(const char *queuename,
  * This will print the message to the console if the verbose level is set to a level >= 3
  *
  * Note the absence of a comma after the VERBOSE_PREFIX_3.  This is important.
- * VERBOSE_PREFIX_1 through VERBOSE_PREFIX_4 are defined.
+ * VERBOSE_PREFIX_1 through VERBOSE_PREFIX_10 are defined.
  *
  * \version 11 added level parameter
  */
index 0d306fdeebe28f6a425414d791135f6f79205852..9bcd02bc317cbc136163bc2795973b98be9dc1ab 100644 (file)
@@ -2164,7 +2164,19 @@ static void set_header(char *outbuf, int maxout, char level)
                break;
        case 3: cmp = VERBOSE_PREFIX_3;
                break;
-       default: cmp = VERBOSE_PREFIX_4;
+       case 4: cmp = VERBOSE_PREFIX_4;
+               break;
+       case 5: cmp = VERBOSE_PREFIX_5;
+               break;
+       case 6: cmp = VERBOSE_PREFIX_6;
+               break;
+       case 7: cmp = VERBOSE_PREFIX_7;
+               break;
+       case 8: cmp = VERBOSE_PREFIX_8;
+               break;
+       case 9: cmp = VERBOSE_PREFIX_9;
+               break;
+       default: cmp = VERBOSE_PREFIX_10;
                break;
        }
 
index c460e91cf4942dd3e4ac01aba24be3378855340b..72d6962456a5ec45ce93ca5f96c5c97a16f1b964 100644 (file)
@@ -342,7 +342,19 @@ static int logger_add_verbose_magic(struct logmsg *logmsg, char *buf, size_t siz
 
        /* For compatibility with modules still calling ast_verbose() directly instead of using ast_verb() */
        if (logmsg->sublevel < 0) {
-               if (!strncmp(logmsg->message, VERBOSE_PREFIX_4, strlen(VERBOSE_PREFIX_4))) {
+               if (!strncmp(logmsg->message, VERBOSE_PREFIX_10, strlen(VERBOSE_PREFIX_10))) {
+                       magic = -11;
+               } else if (!strncmp(logmsg->message, VERBOSE_PREFIX_9, strlen(VERBOSE_PREFIX_9))) {
+                       magic = -10;
+               } else if (!strncmp(logmsg->message, VERBOSE_PREFIX_8, strlen(VERBOSE_PREFIX_8))) {
+                       magic = -9;
+               } else if (!strncmp(logmsg->message, VERBOSE_PREFIX_7, strlen(VERBOSE_PREFIX_7))) {
+                       magic = -8;
+               } else if (!strncmp(logmsg->message, VERBOSE_PREFIX_6, strlen(VERBOSE_PREFIX_6))) {
+                       magic = -7;
+               } else if (!strncmp(logmsg->message, VERBOSE_PREFIX_5, strlen(VERBOSE_PREFIX_5))) {
+                       magic = -6;
+               } else if (!strncmp(logmsg->message, VERBOSE_PREFIX_4, strlen(VERBOSE_PREFIX_4))) {
                        magic = -5;
                } else if (!strncmp(logmsg->message, VERBOSE_PREFIX_3, strlen(VERBOSE_PREFIX_3))) {
                        magic = -4;