Commit 1931f7bb authored by rswindell's avatar rswindell
Browse files

Sysop can over-ride the time-stamp format in the sbbsecho.log by setting

the LogTimeFormat key in sbbsecho.ini. The default is "%Y-%m-%d %H:%M:%S".
If you want the old (v2) time-stamp format, set this value to
"%m/%d/%y %H:%M:%S". Any/all valid strftime() specifiers may be used.
parent 905112f9
......@@ -247,6 +247,7 @@ bool sbbsecho_read_ini(sbbsecho_cfg_t* cfg)
SAFECOPY(cfg->outbound , iniGetString(ini, ROOT_SECTION, "Outbound", "../fido/outbound", value));
SAFECOPY(cfg->areafile , iniGetString(ini, ROOT_SECTION, "AreaFile", "../data/areas.bbs", value));
SAFECOPY(cfg->logfile , iniGetString(ini, ROOT_SECTION, "LogFile", "../data/sbbsecho.log", value));
SAFECOPY(cfg->logtime , iniGetString(ini, ROOT_SECTION, "LogTimeFormat", "%Y-%m-%d %H:%M:%S", value));
SAFECOPY(cfg->temp_dir , iniGetString(ini, ROOT_SECTION, "TempDirectory", "../temp/sbbsecho", value));
SAFECOPY(cfg->outgoing_sem , iniGetString(ini, ROOT_SECTION, "OutgoingSemaphore", "", value));
cfg->log_level = iniGetLogLevel(ini, ROOT_SECTION, "LogLevel", cfg->log_level);
......@@ -446,6 +447,8 @@ bool sbbsecho_write_ini(sbbsecho_cfg_t* cfg)
iniSetString(&ini, ROOT_SECTION, "AreaFile" ,cfg->areafile ,NULL);
if(cfg->logfile[0])
iniSetString(&ini, ROOT_SECTION, "LogFile" ,cfg->logfile ,NULL);
if(cfg->logtime[0])
iniSetString(&ini, ROOT_SECTION, "LogTimeFormat" ,cfg->logtime ,NULL);
if(cfg->temp_dir[0])
iniSetString(&ini, ROOT_SECTION, "TempDirectory" ,cfg->temp_dir ,NULL);
iniSetBytes(&ini, ROOT_SECTION, "BundleSize" ,1,cfg->maxbdlsize ,NULL);
......
......@@ -171,13 +171,15 @@ int lprintf(int level, char *fmt, ...)
time_t now = time(NULL);
struct tm *tm;
struct tm tmbuf = {0};
char timestamp[128];
strip_ctrl(sbuf, sbuf);
if((tm = localtime(&now)) == NULL)
tm = &tmbuf;
fprintf(fidologfile,"%u-%02u-%02u %02u:%02u:%02u %s\n"
,1900+tm->tm_year, tm->tm_mon+1, tm->tm_mday
,tm->tm_hour, tm->tm_min, tm->tm_sec
,sbuf);
if(strftime(timestamp, sizeof(timestamp), cfg.logtime, tm) <= 0)
snprintf(timestamp, sizeof(timestamp)-1, "%u-%02u-%02u %02u:%02u:%02u"
,1900+tm->tm_year, tm->tm_mon+1, tm->tm_mday
,tm->tm_hour, tm->tm_min, tm->tm_sec);
fprintf(fidologfile, "%s %s\n", timestamp, sbuf);
fflush(fidologfile);
}
return(chcount);
......
......@@ -134,6 +134,7 @@ typedef struct {
char outbound[MAX_PATH+1]; /* Outbound directory */
char areafile[MAX_PATH+1]; /* AREAS.BBS path/filename */
char logfile[MAX_PATH+1]; /* LOG path/filename */
char logtime[64]; /* format of log timestamp */
char cfgfile[MAX_PATH+1]; /* Configuration path/filename */
char temp_dir[MAX_PATH+1]; /* Temporary file directory */
char outgoing_sem[MAX_PATH+1]; /* Semaphore file to creat when there's outgoing data */
......
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