GUACAMOLE-259: Add TRACE log level.

This commit is contained in:
Michael Jumper 2017-03-29 22:32:01 -07:00
parent 039a1c52e4
commit e910dcbfcc
7 changed files with 24 additions and 6 deletions

View File

@ -63,7 +63,7 @@ int guacd_conf_parse_args(guacd_config* config, int argc, char** argv) {
/* Validate and parse log level */ /* Validate and parse log level */
int level = guacd_parse_log_level(optarg); int level = guacd_parse_log_level(optarg);
if (level == -1) { if (level == -1) {
fprintf(stderr, "Invalid log level. Valid levels are: \"debug\", \"info\", \"warning\", and \"error\".\n"); fprintf(stderr, "Invalid log level. Valid levels are: \"trace\", \"debug\", \"info\", \"warning\", and \"error\".\n");
return 1; return 1;
} }

View File

@ -78,7 +78,7 @@ static int guacd_conf_callback(const char* section, const char* param, const cha
/* Invalid log level */ /* Invalid log level */
if (level < 0) { if (level < 0) {
guacd_conf_parse_error = "Invalid log level. Valid levels are: \"debug\", \"info\", \"warning\", and \"error\"."; guacd_conf_parse_error = "Invalid log level. Valid levels are: \"trace\", \"debug\", \"info\", \"warning\", and \"error\".";
return 1; return 1;
} }

View File

@ -527,6 +527,7 @@ int guacd_parse_log_level(const char* name) {
if (strcmp(name, "error") == 0) return GUAC_LOG_ERROR; if (strcmp(name, "error") == 0) return GUAC_LOG_ERROR;
if (strcmp(name, "warning") == 0) return GUAC_LOG_WARNING; if (strcmp(name, "warning") == 0) return GUAC_LOG_WARNING;
if (strcmp(name, "debug") == 0) return GUAC_LOG_DEBUG; if (strcmp(name, "debug") == 0) return GUAC_LOG_DEBUG;
if (strcmp(name, "trace") == 0) return GUAC_LOG_TRACE;
/* No such log level */ /* No such log level */
return -1; return -1;

View File

@ -72,6 +72,12 @@ void vguacd_log(guac_client_log_level level, const char* format,
priority_name = "DEBUG"; priority_name = "DEBUG";
break; break;
/* Trace log level */
case GUAC_LOG_TRACE:
priority = LOG_DEBUG;
priority_name = "TRACE";
break;
/* Any unknown/undefined log level */ /* Any unknown/undefined log level */
default: default:
priority = LOG_INFO; priority = LOG_INFO;

View File

@ -66,6 +66,7 @@ Sets the maximum level at which
.B guacd .B guacd
will log messages to syslog and, if running in the foreground, the console. will log messages to syslog and, if running in the foreground, the console.
Legal values are Legal values are
.B trace,
.B debug, .B debug,
.B info, .B info,
.B warning, .B warning,

View File

@ -109,6 +109,7 @@ Sets the maximum level at which
.B guacd .B guacd
will log messages to syslog and, if running in the foreground, the console. will log messages to syslog and, if running in the foreground, the console.
Legal values are Legal values are
.B trace,
.B debug, .B debug,
.B info, .B info,
.B warning, .B warning,

View File

@ -56,8 +56,8 @@ typedef enum guac_client_state {
/** /**
* All supported log levels used by the logging subsystem of each Guacamole * All supported log levels used by the logging subsystem of each Guacamole
* client. These log levels correspond to a subset of the log levels defined by * client. With the exception of GUAC_LOG_TRACE, these log levels correspond to
* RFC 5424. * a subset of the log levels defined by RFC 5424.
*/ */
typedef enum guac_client_log_level { typedef enum guac_client_log_level {
@ -78,9 +78,18 @@ typedef enum guac_client_log_level {
/** /**
* Informational messages which can be useful for debugging, but are * Informational messages which can be useful for debugging, but are
* otherwise not useful to users or administrators. * otherwise not useful to users or administrators. It is expected that
* debug level messages, while verbose, will not negatively affect
* performance.
*/ */
GUAC_LOG_DEBUG = 7 GUAC_LOG_DEBUG = 7,
/**
* Informational messages which can be useful for debugging, like
* GUAC_LOG_DEBUG, but which are so low-level that they may affect
* performance.
*/
GUAC_LOG_TRACE = 8
} guac_client_log_level; } guac_client_log_level;