aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2017-11-20 14:46:19 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-12-15 12:00:49 +0100
commit4da7985204fe57e64dcf616908f17641940a3e13 (patch)
treeab2857aaf36521b0049622103082ba903d7f3dae
parent2a66c38efa3e59c74f9aa4b2d36fbf0f9f06d452 (diff)
downloadlibssh-4da7985204fe57e64dcf616908f17641940a3e13.tar.gz
libssh-4da7985204fe57e64dcf616908f17641940a3e13.tar.xz
libssh-4da7985204fe57e64dcf616908f17641940a3e13.zip
config: Set global log level from configuration file
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/config.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/config.c b/src/config.c
index 7fe23ec9..8419d070 100644
--- a/src/config.c
+++ b/src/config.c
@@ -518,20 +518,25 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
case SOC_LOGLEVEL:
p = ssh_config_get_str_tok(&s, NULL);
if (p && *parsing) {
+ int value = -1;
+
if (strcasecmp(p, "quiet") == 0) {
- ssh_set_log_level(SSH_LOG_NONE);
+ value = SSH_LOG_NONE;
} else if (strcasecmp(p, "fatal") == 0 ||
strcasecmp(p, "error")== 0 ||
strcasecmp(p, "info") == 0) {
- ssh_set_log_level(SSH_LOG_WARN);
+ value = SSH_LOG_WARN;
} else if (strcasecmp(p, "verbose") == 0) {
- ssh_set_log_level(SSH_LOG_INFO);
+ value = SSH_LOG_INFO;
} else if (strcasecmp(p, "DEBUG") == 0 ||
strcasecmp(p, "DEBUG1") == 0) {
- ssh_set_log_level(SSH_LOG_DEBUG);
+ value = SSH_LOG_DEBUG;
} else if (strcasecmp(p, "DEBUG2") == 0 ||
strcasecmp(p, "DEBUG3") == 0) {
- ssh_set_log_level(SSH_LOG_TRACE);
+ value = SSH_LOG_TRACE;
+ }
+ if (value != -1) {
+ ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &value);
}
}
break;