]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Starting to implement rou_dbglive
authorJean-Marc Pigeon <jmp@safe.c>
Sun, 16 Nov 2025 17:37:05 +0000 (12:37 -0500)
committerJean-Marc Pigeon <jmp@safe.c>
Sun, 16 Nov 2025 17:37:05 +0000 (12:37 -0500)
lib/subrou.c
lib/subrou.h
sysconfig/mailleur

index a67b74738fd611e88c9c2cf74bfc6e626a1d4dea..6e88a3c66d3e5c35d3f6e7dd8d3264e421bb4b2d 100644 (file)
@@ -582,31 +582,28 @@ PUBLIC void rou_valert(const int dlevel,const char *fmt,va_list ap)
 #define        DEBMAX  140
 
 {
-if (debug>=dlevel)
-  {
-  char lvl[10];
-  char strloc[10000];
-
-  (void) snprintf(lvl,sizeof(lvl),"(dl=%02d) ",dlevel);
-  (void) memset(strloc,'\000',sizeof(strloc));
-  (void) vsnprintf(strloc,sizeof(strloc)-1,fmt,ap);
-  if (foreground==true)
-    (void) fprintf(stderr,"%s%s\n",lvl,strloc);
-  else {
-    char *ptr;
-    ptr=strloc;
-    while (strlen(ptr)>DEBMAX) {
-      char locline[DEBMAX+10];
-  
-      (void) strncpy(locline,ptr,DEBMAX);
-      locline[DEBMAX]='\000';
-      (void) syslog(LOG_INFO,"%s%s",lvl,locline);
-      ptr +=DEBMAX;
-      (void) strcpy(lvl,"");
-      } 
-    if (strlen(ptr)>0)
-      (void) syslog(LOG_INFO,"%s%s",lvl,ptr);
-    }
+char lvl[10];
+char strloc[10000];
+
+(void) snprintf(lvl,sizeof(lvl),"(dl=%02d) ",dlevel);
+(void) memset(strloc,'\000',sizeof(strloc));
+(void) vsnprintf(strloc,sizeof(strloc)-1,fmt,ap);
+if (foreground==true)
+  (void) fprintf(stderr,"%s%s\n",lvl,strloc);
+else {
+  char *ptr;
+  ptr=strloc;
+  while (strlen(ptr)>DEBMAX) {
+    char locline[DEBMAX+10];
+
+    (void) strncpy(locline,ptr,DEBMAX);
+    locline[DEBMAX]='\000';
+    (void) syslog(LOG_INFO,"%s%s",lvl,locline);
+    ptr +=DEBMAX;
+    (void) strcpy(lvl,"");
+    } 
+  if (strlen(ptr)>0)
+    (void) syslog(LOG_INFO,"%s%s",lvl,ptr);
   }
 }
 /*
@@ -620,11 +617,33 @@ if (debug>=dlevel)
 PUBLIC void rou_alert(const int dlevel,const char *fmt,...)
 
 {
-va_list args;
+if (debug>=dlevel) {
+  va_list args;
 
-va_start(args,fmt);
-(void) rou_valert(dlevel,fmt,args);
-va_end(args);
+  va_start(args,fmt);
+  (void) rou_valert(dlevel,fmt,args);
+  va_end(args);
+  }
+}
+/*
+\f
+*/
+/********************************************************/
+/*                                                     */
+/*     Subroutine to do live debug on a specific       */
+/*      function.                                       */
+/*                                                     */
+/********************************************************/
+PUBLIC void rou_dbglive(const int dlevel,const char *fmt,...)
+
+{
+if (debug>=dlevel) {
+  va_list args;
+
+  va_start(args,fmt);
+  (void) rou_valert(dlevel,fmt,args);
+  va_end(args);
+  }
 }
 /*
 \f
index d95cb5362a67abddd7f13e168e0f260924147ea0..42b9c96bff9df1046a0f51e54fb677d37ebdee02 100644 (file)
@@ -105,6 +105,9 @@ void rou_valert(const int dlevel,const char *fmt,va_list ap);
 //via syslog (LOG_DAEMON)
 extern void rou_alert(const int dlevel,const char *fmt,...);
 
+//procedure to debug live daemon process
+extern void rou_dbglive(const int dlevel,const char *fmt,...);
+
 //To do an on purpose crash the application with an
 //explication message
 extern void rou_crash(const char *fmt,...);
index f6e134c4cd621b36d1868a3bf7f6d2280119cca1..03cb8bbc5ab3f64487c4a258d4c0f353761bfe2a 100644 (file)
@@ -1,5 +1,7 @@
 #-------------------------------------------
 #options available to debug mailleur
 #OPTIONS="-d9"
+#this is to debug a specific function within a specific module
+#DBGLIV="lvleml.c:checkto,modrec.c:docontact"
 #-------------------------------------------