diff --git a/dcapi/common/logger.c b/dcapi/common/logger.c index 265968808f..46e561f4d8 100644 --- a/dcapi/common/logger.c +++ b/dcapi/common/logger.c @@ -1,4 +1,7 @@ -#include +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -6,6 +9,10 @@ #include #include +#ifndef _WIN32 +#include +#endif + #include #include @@ -17,13 +24,21 @@ static int loglevel = -1; static FILE *logfile; +/* Stupid Visual C compiler */ +#ifdef _MSC_VER +#define INIT(x, y) y +#else +#define INIT(x, y) [x] = y +#endif + static const char *levels[] = { - [LOG_DEBUG] = "Debug", - [LOG_INFO] = "Info", - [LOG_NOTICE] = "Notice", - [LOG_WARNING] = "Warning", - [LOG_ERR] = "Error" + INIT(LOG_DEBUG, "Debug"), + INIT(LOG_INFO, "Info"), + INIT(LOG_NOTICE, "Notice"), + INIT(LOG_WARNING, "Warning"), + INIT(LOG_ERR, "Error"), + INIT(LOG_CRIT, "Critical") }; static void init_log(void)