summaryrefslogtreecommitdiffstats
path: root/sdnvpn/lib/logutil.py
diff options
context:
space:
mode:
authorPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>2018-04-30 13:58:02 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-04-30 13:58:02 +0000
commit23ec5914be722401dcbc2ceb9f4be1491c150776 (patch)
treef4dc4ec138e5cf9cf8f662c87705e180b9396327 /sdnvpn/lib/logutil.py
parentbe6cce375c0363f93fa6b1a099eb34fee75a6161 (diff)
parent84f2176cf1aa9d61889ca80aeb25dfd01d25d8a1 (diff)
Merge "Make sdnvpn logging proper" into stable/fraser
Diffstat (limited to 'sdnvpn/lib/logutil.py')
-rw-r--r--sdnvpn/lib/logutil.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/sdnvpn/lib/logutil.py b/sdnvpn/lib/logutil.py
new file mode 100644
index 0000000..3710ca1
--- /dev/null
+++ b/sdnvpn/lib/logutil.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2018 All rights reserved
+# This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+import logging
+import os.path
+
+from xtesting.core import feature
+
+
+def getLogger(module_name):
+ logger = logging.getLogger(module_name)
+ log_file = "{}/{}.log".format("/var/lib/xtesting/results", "bgpvpn")
+ if os.path.exists(log_file):
+ feature.Feature.configure_logger(logger, log_file)
+ else:
+ logger.setLevel(logging.DEBUG)
+ return logger