From 7023f51778d9a73d1fbfa7cab52cacbbee43a800 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Wed, 26 Mar 2025 11:24:48 -0400 Subject: [PATCH] Improving devlog --- Makefile | 2 +- lib/devlog.c | 16 ++++++++++------ lib/subrou.c | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 72959d1..e85004f 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ DATA = chkaddr.spf.example.com 127.0.1.255 #preparing a test area newtest : deltest @ mkdir -p $(TESTDIR)/var/run - @ mkdir -p $(TESTDIR)/var/spool/clement/{in,out}-logs + @ mkdir -p $(TESTDIR)/var/spool/$(APPNAME)/{in,out}-logs @ mkdir -p $(TESTDIR)/$(SBINDIR) @ cp -a \ bin/{chkspf,emlrcvr} \ diff --git a/lib/devlog.c b/lib/devlog.c index 3c9b6eb..dd98808 100644 --- a/lib/devlog.c +++ b/lib/devlog.c @@ -14,8 +14,9 @@ #include "uniprc.h" #include "devlog.h" -#define IJRLDIR "/var/spool/clement/in-logs/" -#define OJRLDIR "/var/spool/clement/out-logs/" +#define JRLDIR "/var/spool/"APPNAME +#define IJRLDIR JRLDIR"/in-logs/" +#define OJRLDIR JRLDIR"/out-logs/" typedef struct { @@ -90,8 +91,14 @@ while (proceed==true) { (void) rou_alert(0,"%s Unable to open file <%s> (error=<%s>)", OPEP,log->filename,strerror(errno)); log=freelog(log); + phase=999; //No need to go further } break; + case 3 : //writing a minimal data + (void) clock_gettime(CLOCK_REALTIME,&(log->start)); + (void) fprintf(log->file,"#%s\n",ctime(&(log->start.tv_sec))); + log->start.tv_sec=0; + break; default : //SAFE guard proceed=false; break; @@ -211,11 +218,8 @@ while (proceed==true) { phase=999; } break; - case 3 : //string the formated line within logs - (void) fprintf(log->file,"%s %s\n",chrono,line); - line=rou_freestr(line); - break; default : //SAFE guard + line=rou_freestr(line); proceed=false; break; } diff --git a/lib/subrou.c b/lib/subrou.c index 7cedae9..0b76f1a 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -21,7 +21,7 @@ //version definition #define VERSION "0.6" -#define RELEASE "15" +#define RELEASE "16" //Public variables PUBLIC int debug=0; //debug level -- 2.47.3