From: Jean-Marc Pigeon Date: Sun, 16 Nov 2025 17:37:05 +0000 (-0500) Subject: Starting to implement rou_dbglive X-Git-Tag: tag-0.18~44 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=247f00be4328f61ffdc93404b4b517a69743c969;p=jmp%2Fmailleur Starting to implement rou_dbglive --- diff --git a/lib/subrou.c b/lib/subrou.c index a67b747..6e88a3c 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -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); + } +} +/* + +*/ +/********************************************************/ +/* */ +/* 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); + } } /* diff --git a/lib/subrou.h b/lib/subrou.h index d95cb53..42b9c96 100644 --- a/lib/subrou.h +++ b/lib/subrou.h @@ -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,...); diff --git a/sysconfig/mailleur b/sysconfig/mailleur index f6e134c..03cb8bb 100644 --- a/sysconfig/mailleur +++ b/sysconfig/mailleur @@ -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" #-------------------------------------------