From 2c13ef5c6dd90ee2dcbcba282b2ee702e2ee9f84 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Fri, 8 Jul 2016 01:47:31 +0000 Subject: [PATCH] Use enum logLevels consistently for log levels --- common/log.h | 4 ++-- sesman/chansrv/chansrv.c | 10 +++++----- sesman/tools/sestest.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/log.h b/common/log.h index b90ac660..61a05d9c 100644 --- a/common/log.h +++ b/common/log.h @@ -68,9 +68,9 @@ struct log_config const char *program_name; char *log_file; int fd; - unsigned int log_level; + enum logLevels log_level; int enable_syslog; - unsigned int syslog_level; + enum logLevels syslog_level; pthread_mutex_t log_lock; pthread_mutexattr_t log_lock_attr; }; diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index 0596b5ff..d272806c 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -1401,8 +1401,8 @@ get_log_path() } /*****************************************************************************/ -static unsigned int APP_CC -get_log_level(const char* level_str, unsigned int default_level) +static enum logLevels APP_CC +get_log_level(const char* level_str, enum logLevels default_level) { static const char* levels[] = { "LOG_LEVEL_ALWAYS", @@ -1421,7 +1421,7 @@ get_log_level(const char* level_str, unsigned int default_level) { if (g_strcasecmp(levels[i], level_str) == 0) { - return i; + return (enum logLevels) i; } } return default_level; @@ -1466,7 +1466,7 @@ main(int argc, char **argv) char log_file[256]; enum logReturns error; struct log_config logconfig; - unsigned int log_level; + enum logLevels log_level; g_init("xrdp-chansrv"); /* os_calls */ @@ -1498,7 +1498,7 @@ main(int argc, char **argv) logconfig.fd = -1; logconfig.log_level = log_level; logconfig.enable_syslog = 0; - logconfig.syslog_level = 0; + logconfig.syslog_level = LOG_LEVEL_ALWAYS; error = log_start_from_param(&logconfig); if (error != LOG_STARTUP_OK) diff --git a/sesman/tools/sestest.c b/sesman/tools/sestest.c index 17795dfc..081bc88b 100644 --- a/sesman/tools/sestest.c +++ b/sesman/tools/sestest.c @@ -44,7 +44,7 @@ int main(int argc, char **argv) int sock; log.enable_syslog = 0; - log.log_level = 99; + log.log_level = LOG_LEVEL_DEBUG; log.program_name = "sestest"; log.log_file = g_strdup("sestest.log"); log_start_from_param(&log);