- more AsconStatus states
- enhancements in binprot - make Logger public (logger.h) - added lscprot (50 ms write delay for lakeshore models) - additonal bug fixes
This commit is contained in:
21
logger.c
21
logger.c
@@ -15,18 +15,6 @@ Markus Zolliker, Sept 2004
|
||||
#include <ctype.h>
|
||||
#include "logger.h"
|
||||
|
||||
struct Logger {
|
||||
char *name;
|
||||
char *old;
|
||||
int oldsize;
|
||||
int period;
|
||||
time_t last, lastWrite, omitTime;
|
||||
int numeric;
|
||||
float omitValue;
|
||||
int exact;
|
||||
Logger *next;
|
||||
};
|
||||
|
||||
static char *dir = NULL;
|
||||
static Logger *list;
|
||||
static time_t lastLife = 0;
|
||||
@@ -152,6 +140,7 @@ int LoggerWrite0(Logger * log, time_t now, int period, char *value)
|
||||
int l, ext, writeInfo;
|
||||
FILE *fil;
|
||||
time_t beforenow;
|
||||
char *nl;
|
||||
|
||||
if (log->name[0] == '\0')
|
||||
return 0;
|
||||
@@ -211,7 +200,13 @@ int LoggerWrite0(Logger * log, time_t now, int period, char *value)
|
||||
}
|
||||
}
|
||||
strftime(stim, sizeof stim, "%H:%M:%S", &tm);
|
||||
fprintf(fil, "%s\t%s\n", stim, value);
|
||||
nl = strchr(value, '\n');
|
||||
if (nl == NULL) {
|
||||
fprintf(fil, "%s\t%s\n", stim, value);
|
||||
} else {
|
||||
/* newline within string! do write only characters before nl */
|
||||
fprintf(fil, "%s\t%.*s\n", stim, (nl - value), value);
|
||||
}
|
||||
log->lastWrite = now;
|
||||
fclose(fil);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user