[network-manager-pptp: 7/12] service: allow setting log_level via environment variable NM_VPN_LOG_LEVEL
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-pptp: 7/12] service: allow setting log_level via environment variable NM_VPN_LOG_LEVEL
- Date: Tue, 20 Sep 2016 10:07:00 +0000 (UTC)
commit 3d6cb1b6973c1bc100cadee407a1b26e5a30c28e
Author: Thomas Haller <thaller redhat com>
Date: Fri Sep 16 16:44:57 2016 +0200
service: allow setting log_level via environment variable NM_VPN_LOG_LEVEL
NetworkManager sets NM_VPN_LOG_LEVEL depending on the logging setting:
$ nmcli general logging level KEEP domains VPN_PLUGIN:TRACE
src/Makefile.am | 2 ++
src/nm-pptp-service.c | 5 ++++-
2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 4f3f536..455ae44 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,6 +4,8 @@ noinst_LTLIBRARIES = libnm-pptp-pppd-service-dbus.la
shared_sources = \
$(top_srcdir)/shared/nm-service-defines.h \
+ $(top_srcdir)/shared/nm-utils/nm-shared-utils.c \
+ $(top_srcdir)/shared/nm-utils/nm-shared-utils.h \
$(top_srcdir)/shared/nm-utils/nm-vpn-plugin-macros.h
AM_CPPFLAGS = \
diff --git a/src/nm-pptp-service.c b/src/nm-pptp-service.c
index 38dfd53..506a96d 100644
--- a/src/nm-pptp-service.c
+++ b/src/nm-pptp-service.c
@@ -45,6 +45,7 @@
#include "nm-ppp-status.h"
#include "nm-pptp-pppd-service-dbus.h"
+#include "nm-utils/nm-shared-utils.h"
#include "nm-utils/nm-vpn-plugin-macros.h"
#if !defined(DIST_VERSION)
@@ -1148,7 +1149,9 @@ main (int argc, char *argv[])
if (getenv ("NM_PPP_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 ("nm-pptp-service (version " DIST_VERSION ") starting...");
_LOGD (" uses%s --bus-name \"%s\"", bus_name_free ? "" : " default", bus_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]