}
switch (level) {
- case LOG_ERROR_LEVEL: level_string = "ERROR"; break;
- case LOG_WARNING_LEVEL: level_string = "WARN "; break;
- case LOG_DEBUG_LEVEL: level_string = "DEBUG"; break;
+ case LOG_ERROR_LEVEL: level_string = "ERROR "; break;
+ case LOG_WARNING_LEVEL: level_string = " WARN "; break;
+ case LOG_DEBUG1_LEVEL: level_string = "DEBUG1"; break;
+ case LOG_DEBUG2_LEVEL: level_string = "DEBUG2"; break;
default: level_string = "UNKNOWN";
}
(void)line;
#endif
- /* Prevent another thread from interrupting the two printfs(). */
- flockfile(stdout);
+ /* Prevent another thread from interrupting the printfs(). */
+ flockfile(stderr);
- fprintf(stdout,
#ifdef DEBUG
- "%-12s:%-3d "
+ fprintf(stderr, "%-12s:%-4d ", file, line);
#endif
- "[%s] [%d] ",
-#ifdef DEBUG
- file, line,
-#endif
- level_string, (int)pthread_self());
+ fprintf(stderr, "[%s] [%ld] ", level_string, (long)pthread_self());
va_start(ap, format);
- vfprintf(stdout, format, ap);
+ vfprintf(stderr, format, ap);
va_end(ap);
- fprintf(stdout, "\n");
+ fprintf(stderr, "\n");
- funlockfile(stdout);
+ funlockfile(stderr);
}