various improvements
- use dig for resolving host names - ascon.c: fix terminator parsing - property callback: change property before callback - logger.c:default for logger period must be the old value instead of 1 - add frappy type history writing - increase max. logreader line length - HIPNONE returns "null" with json protocol - encode strings properly in formatNameValue - fix memory leak in json2tcl - scriptcontext: do not show debug messages when script starts with underscore or when the "send" property is empty - scriptcontext: remove args for action timestamp - scriptcontext: "que" function will replace an already queued action, e.g. for 'halt - introduced updatestatus script
This commit is contained in:
21
logger.c
21
logger.c
@ -49,6 +49,12 @@ Logger *LoggerFind(const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
Logger *LoggerList(void)
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#define LASTLOGTXT "#last logging entry at:\n"
|
||||
|
||||
@ -158,8 +164,13 @@ int LoggerWrite0(Logger * log, time_t now, int period, char *value)
|
||||
strftime(path + l, sizeof path - l, "%m-%d.log", &tm);
|
||||
strftime(stim, sizeof stim, "#%Y-%m-%d %H:%M:%S", &tm);
|
||||
|
||||
if (period <= 0)
|
||||
period = 1;
|
||||
if (period <= 0) {
|
||||
if (log->period > 0) {
|
||||
period = log->period;
|
||||
} else {
|
||||
period = 1;
|
||||
}
|
||||
}
|
||||
writeInfo = (tm.tm_isdst != lasttm.tm_isdst ||
|
||||
tm.tm_yday != lasttm.tm_yday ||
|
||||
(period != log->period && log->numeric));
|
||||
@ -373,7 +384,7 @@ void LoggerKill(Logger * log)
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int LoggerMakeDir(char *path)
|
||||
int LoggerMakeDir(char *path)
|
||||
{
|
||||
static char buffer[4096];
|
||||
struct stat st;
|
||||
@ -473,6 +484,10 @@ void LoggerFreeAll(void)
|
||||
free(p->name);
|
||||
if (p->old)
|
||||
free(p->old);
|
||||
if (p->secop_old)
|
||||
free(p->secop_old);
|
||||
if (p->secop_id)
|
||||
free(p->secop_id);
|
||||
free(p);
|
||||
p = next;
|
||||
}
|
||||
|
Reference in New Issue
Block a user