summaryrefslogtreecommitdiff
path: root/src/log.c
diff options
context:
space:
mode:
authorAvuton Olrich <avuton@gmail.com>2006-07-20 16:02:40 +0000
committerAvuton Olrich <avuton@gmail.com>2006-07-20 16:02:40 +0000
commit29a25b9933b32800f58dd73d5d1fc21993071c92 (patch)
tree4f456a6f8e44d42acc289c35534ea3e59c0aa96f /src/log.c
parent099f0e103f7591eef81183292d704b3a77a99018 (diff)
Add mpd-indent.sh
Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/log.c')
-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");