[network-manager-libreswan/th/vpn-plugin-debug-bgo766872: 15/20] service: allow setting log_level via environment variable NM_VPN_LOG_LEVEL



commit 903626779004397f58d38fa1e0375e3b1cdda2ab
Author: Thomas Haller <thaller redhat com>
Date:   Thu May 26 17:18:59 2016 +0200

    service: allow setting log_level via environment variable NM_VPN_LOG_LEVEL

 src/nm-libreswan-service.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index 100d5c8..70acc67 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -53,6 +53,7 @@
 
 #include "nm-libreswan-helper-service-dbus.h"
 #include "utils.h"
+#include "nm-utils/nm-shared-utils.h"
 #include "nm-vpn/nm-vpn-plugin-macros.h"
 
 #if !defined(DIST_VERSION)
@@ -1996,7 +1997,7 @@ main (int argc, char *argv[])
        g_option_context_add_main_entries (opt_ctx, options, NULL);
 
        g_option_context_set_summary (opt_ctx,
-               _("This service provides integrated IPsec VPN capability to NetworkManager."));
+           _("This service provides integrated IPsec VPN capability to NetworkManager."));
 
        g_option_context_parse (opt_ctx, &argc, &argv, NULL);
        g_option_context_free (opt_ctx);
@@ -2004,7 +2005,9 @@ main (int argc, char *argv[])
        if (getenv ("LIBRESWAN_DEBUG") || getenv ("IPSEC_DEBUG"))
                gl.debug = TRUE;
 
-       gl.log_level = gl.debug ? LOG_INFO : LOG_NOTICE;
+       gl.log_level = _nm_utils_ascii_str_to_int64 (getenv ("NM_VPN_LOG_LEVEL"),
+                                                    10, 0, LOG_DEBUG,
+                                                    gl.debug ? LOG_INFO : LOG_NOTICE);
 
        _LOGD ("%s (version " DIST_VERSION ") starting...", argv[0]);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]