aboutsummaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/log.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/src/log.c b/src/log.c
index c9fc5a82f..39d05e14a 100644
--- a/src/log.c
+++ b/src/log.c
@@ -29,36 +29,39 @@
int logLevel = LOG_LEVEL_LOW;
short warningFlushed = 0;
-static char * warningBuffer = NULL;
-
-void initLog(void) {
- ConfigParam * param = getConfigParam(CONF_LOG_LEVEL);
-
- if(!param) return;
-
- if(0 == strcmp(param->value, "default")) {
- if(logLevel<LOG_LEVEL_LOW) logLevel = LOG_LEVEL_LOW;
- }
- else if(0 == strcmp(param->value, "secure")) {
- if(logLevel<LOG_LEVEL_SECURE) logLevel = LOG_LEVEL_SECURE;
- }
- else if(0 == strcmp(param->value, "verbose")) {
- if(logLevel<LOG_LEVEL_DEBUG) logLevel = LOG_LEVEL_DEBUG;
- }
- else {
+static char *warningBuffer = NULL;
+
+void initLog(void)
+{
+ ConfigParam *param = getConfigParam(CONF_LOG_LEVEL);
+
+ if (!param)
+ return;
+
+ if (0 == strcmp(param->value, "default")) {
+ if (logLevel < LOG_LEVEL_LOW)
+ logLevel = LOG_LEVEL_LOW;
+ } else if (0 == strcmp(param->value, "secure")) {
+ if (logLevel < LOG_LEVEL_SECURE)
+ logLevel = LOG_LEVEL_SECURE;
+ } else if (0 == strcmp(param->value, "verbose")) {
+ if (logLevel < LOG_LEVEL_DEBUG)
+ logLevel = LOG_LEVEL_DEBUG;
+ } else {
ERROR("unknown log level \"%s\" at line %i\n",
- param->value, param->line);
+ param->value, param->line);
exit(EXIT_FAILURE);
}
}
#define BUFFER_LENGTH 4096
-void bufferWarning(char * format, ... ) {
+void bufferWarning(char *format, ...)
+{
va_list arglist;
- char temp[BUFFER_LENGTH+1];
+ char temp[BUFFER_LENGTH + 1];
- memset(temp, 0, BUFFER_LENGTH+1);
+ memset(temp, 0, BUFFER_LENGTH + 1);
va_start(arglist, format);
@@ -69,15 +72,17 @@ void bufferWarning(char * format, ... ) {
va_end(arglist);
}
-void flushWarningLog(void) {
- char * s;
+void flushWarningLog(void)
+{
+ char *s;
DEBUG("flushing warning messages\n");
- if(warningBuffer == NULL) return;
+ if (warningBuffer == NULL)
+ return;
s = strtok(warningBuffer, "\n");
- while ( s != NULL ) {
+ while (s != NULL) {
myfprintf(stderr, "%s\n", s);
s = strtok(NULL, "\n");