Use enum logLevels consistently for log levels

master
Pavel Roskin 9 years ago
parent 0c72ee2371
commit 2c13ef5c6d

@ -68,9 +68,9 @@ struct log_config
const char *program_name; const char *program_name;
char *log_file; char *log_file;
int fd; int fd;
unsigned int log_level; enum logLevels log_level;
int enable_syslog; int enable_syslog;
unsigned int syslog_level; enum logLevels syslog_level;
pthread_mutex_t log_lock; pthread_mutex_t log_lock;
pthread_mutexattr_t log_lock_attr; pthread_mutexattr_t log_lock_attr;
}; };

@ -1401,8 +1401,8 @@ get_log_path()
} }
/*****************************************************************************/ /*****************************************************************************/
static unsigned int APP_CC static enum logLevels APP_CC
get_log_level(const char* level_str, unsigned int default_level) get_log_level(const char* level_str, enum logLevels default_level)
{ {
static const char* levels[] = { static const char* levels[] = {
"LOG_LEVEL_ALWAYS", "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) if (g_strcasecmp(levels[i], level_str) == 0)
{ {
return i; return (enum logLevels) i;
} }
} }
return default_level; return default_level;
@ -1466,7 +1466,7 @@ main(int argc, char **argv)
char log_file[256]; char log_file[256];
enum logReturns error; enum logReturns error;
struct log_config logconfig; struct log_config logconfig;
unsigned int log_level; enum logLevels log_level;
g_init("xrdp-chansrv"); /* os_calls */ g_init("xrdp-chansrv"); /* os_calls */
@ -1498,7 +1498,7 @@ main(int argc, char **argv)
logconfig.fd = -1; logconfig.fd = -1;
logconfig.log_level = log_level; logconfig.log_level = log_level;
logconfig.enable_syslog = 0; logconfig.enable_syslog = 0;
logconfig.syslog_level = 0; logconfig.syslog_level = LOG_LEVEL_ALWAYS;
error = log_start_from_param(&logconfig); error = log_start_from_param(&logconfig);
if (error != LOG_STARTUP_OK) if (error != LOG_STARTUP_OK)

@ -44,7 +44,7 @@ int main(int argc, char **argv)
int sock; int sock;
log.enable_syslog = 0; log.enable_syslog = 0;
log.log_level = 99; log.log_level = LOG_LEVEL_DEBUG;
log.program_name = "sestest"; log.program_name = "sestest";
log.log_file = g_strdup("sestest.log"); log.log_file = g_strdup("sestest.log");
log_start_from_param(&log); log_start_from_param(&log);

Loading…
Cancel
Save