GUAC-911: Add config file option for log levels.
This commit is contained in:
parent
f71067b024
commit
049c366b78
@ -25,6 +25,8 @@
|
||||
#include "conf-file.h"
|
||||
#include "conf-parse.h"
|
||||
|
||||
#include <guacamole/client.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -72,6 +74,30 @@ static int guacd_conf_callback(const char* section, const char* param, const cha
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Max log level */
|
||||
else if (strcmp(param, "log_level") == 0) {
|
||||
|
||||
/* Translate level name */
|
||||
if (strcmp(value, "info") == 0)
|
||||
config->max_log_level = GUAC_LOG_INFO;
|
||||
else if (strcmp(value, "error") == 0)
|
||||
config->max_log_level = GUAC_LOG_ERROR;
|
||||
else if (strcmp(value, "warning") == 0)
|
||||
config->max_log_level = GUAC_LOG_WARNING;
|
||||
else if (strcmp(value, "debug") == 0)
|
||||
config->max_log_level = GUAC_LOG_DEBUG;
|
||||
|
||||
/* Invalid log level */
|
||||
else {
|
||||
guacd_conf_parse_error = "Invalid log level. Valid levels are: \"debug\", \"info\", \"warning\", and \"error\".";
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Valid log level */
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* SSL-specific options */
|
||||
@ -163,6 +189,7 @@ guacd_config* guacd_conf_load() {
|
||||
conf->bind_port = strdup("4822");
|
||||
conf->pidfile = NULL;
|
||||
conf->foreground = 0;
|
||||
conf->max_log_level = GUAC_LOG_INFO;
|
||||
|
||||
#ifdef ENABLE_SSL
|
||||
conf->cert_file = NULL;
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <guacamole/client.h>
|
||||
|
||||
/**
|
||||
* The contents of a guacd configuration file.
|
||||
*/
|
||||
@ -62,6 +64,11 @@ typedef struct guacd_config {
|
||||
char* key_file;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The maximum log level to be logged by guacd.
|
||||
*/
|
||||
guac_client_log_level max_log_level;
|
||||
|
||||
} guacd_config;
|
||||
|
||||
/**
|
||||
|
@ -86,6 +86,19 @@ will bind to port 4822.
|
||||
.
|
||||
.SH DAEMON PARAMETERS
|
||||
.TP
|
||||
\fBlog_level\fR \fB=\fR \fILEVEL\fR
|
||||
Sets the maximum level at which
|
||||
.B guacd
|
||||
will log messages to syslog and, if running in the foreground, the console.
|
||||
Legal values are
|
||||
.B debug,
|
||||
.B info,
|
||||
.B warning,
|
||||
and
|
||||
.B error.
|
||||
The default value is
|
||||
.B info.
|
||||
.TP
|
||||
\fBpid_file\fR \fB=\fR \fIFILE\fR
|
||||
Causes
|
||||
.B guacd
|
||||
|
Loading…
Reference in New Issue
Block a user