Commit a0e94174 authored by rswindell's avatar rswindell
Browse files

SBBSecho log level is now configurable (in echocfg), and defaults to "Info" level

instead of "Notice".
parent e54ac97f
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2002 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -106,6 +106,9 @@ char *wcfaddrtoa(faddr_t* addr)
return(str);
}
/* These correlate with the LOG_* definitions in syslog.h/gen_defs.h */
static char* logLevelStringList[]
= {"Emergency", "Alert", "Critical", "Error", "Warning", "Notice", "Informational", "Debugging", NULL};
int main(int argc, char **argv)
{
......@@ -270,6 +273,7 @@ int main(int argc, char **argv)
sprintf(opt[i++],"%-30.30s %s","Areafix Failure Notification",str);
sprintf(opt[i++],"Nodes...");
sprintf(opt[i++],"Paths...");
sprintf(opt[i++],"%-30.30s %s","Log Level",logLevelStringList[cfg.log_level]);
sprintf(opt[i++],"Log Options...");
sprintf(opt[i++],"Toggle Options...");
sprintf(opt[i++],"Archive Programs...");
......@@ -650,6 +654,16 @@ int main(int argc, char **argv)
break;
case 6:
uifc.helpbuf=
"~ Log Level ~\r\n"
"\r\n"
"Select the minimum severity of log entries to be logged to the log file.";
j=cfg.log_level;
i=uifc.list(WIN_MID,0,0,0,&j,0,"Log Level",logLevelStringList);
if(i>=0 && i<=LOG_DEBUG)
cfg.log_level=i;
break;
case 7:
uifc.helpbuf=
" Log Options \r\n"
"\r\n"
"Each loggable item can be toggled off or on from this menu. You must run\r\n"
......@@ -748,7 +762,7 @@ int main(int argc, char **argv)
break;
case 7:
case 8:
uifc.helpbuf=
"Secure Operation tells SBBSecho to check the AREAS.BBS file to insure\r\n"
" that the packet origin exists there as well as check the password of\r\n"
......@@ -833,7 +847,7 @@ int main(int argc, char **argv)
}
}
break;
case 8:
case 9:
uifc.helpbuf=
" Archive Programs \r\n\r\n"
"These are the archiving programs (types) which are available for\r\n"
......@@ -940,7 +954,7 @@ int main(int argc, char **argv)
break;
} } }
break;
case 9:
case 10:
uifc.helpbuf=
" Additional Echo Lists \r\n\r\n"
"This feature allows you to specify echo lists (in addition to your\r\n"
......@@ -1174,6 +1188,7 @@ int main(int argc, char **argv)
fprintf(stream,"LOG NONE\n");
else
fprintf(stream,"LOG %08lX\n",cfg.log); }
fprintf(stream,"LOG_LEVEL %u",cfg.log_level);
if(cfg.inbound[0])
fprintf(stream,"INBOUND %s\n",cfg.inbound);
if(cfg.secure[0])
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -196,6 +196,7 @@ void read_echo_cfg()
cfg.maxbdlsize=DFLT_BDL_SIZE;
cfg.badecho=-1;
cfg.log=LOG_DEFAULTS;
cfg.log_level=LOG_INFO;
cfg.check_path=TRUE;
while(1) {
......@@ -276,6 +277,10 @@ void read_echo_cfg()
cfg.log=strtol(cleanstr(p),0,16);
continue; }
if(!stricmp(tmp,"LOG_LEVEL")) {
cfg.log_level=atoi(cleanstr(p));
continue; }
if(!stricmp(tmp,"NOSWAP")) {
continue; }
......
......@@ -72,7 +72,6 @@ smb_t *smb,*email;
long misc=(IMPORT_PACKETS|IMPORT_NETMAIL|IMPORT_ECHOMAIL|EXPORT_ECHOMAIL
|DELETE_NETMAIL|DELETE_PACKETS);
ulong netmail=0;
int log_level=LOG_NOTICE;
char tmp[256],pkt_type=0;
int secure,cur_smb=0;
FILE *fidologfile=NULL;
......@@ -141,7 +140,7 @@ int lprintf(int level, char *fmat, ...)
truncsp(sbuf);
printf("%s\n",sbuf);
if(level<=log_level)
if(level<=cfg.log_level)
logprintf("%s",sbuf);
return(chcount);
}
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -219,7 +219,8 @@ typedef struct {
,cfgfile[128]; /* Configuration path/filename */
ulong maxpktsize /* Maximum size for packets */
,maxbdlsize /* Maximum size for bundles */
,log; /* What do we log? */
,log /* What do we log? */
,log_level; /* Highest level (lowest severity) */
int badecho; /* Area to store bad echomail msgs */
uint arcdefs /* Number of archive definitions */
,nodecfgs /* Number of nodes with configs */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment