Set NFD logging level from GUI
refs: #2913
Change-Id: I4255b0467ef8ee6c4a2803ed078256cac9fbfd9c
diff --git a/ndn/conf_parser.py b/ndn/conf_parser.py
index 62cc8fa..395c6d7 100644
--- a/ndn/conf_parser.py
+++ b/ndn/conf_parser.py
@@ -6,6 +6,7 @@
self.name = name
self.app = app
self.uri_tuples = params
+ self.params = params
self.cpu = cpu
self.cores = cores
self.cache = cache
diff --git a/ndn/gui.py b/ndn/gui.py
index c4097e4..653dbbc 100644
--- a/ndn/gui.py
+++ b/ndn/gui.py
@@ -48,6 +48,12 @@
self.logLevel = StringVar(self)
self.addDropDown("Log level:", self.logLevel, LOG_LEVELS, LOG_LEVELS[3])
+ def getValues(self):
+ return {
+ "log-level": self.logLevel.get()
+ }
+
+
class NlsrFrame(GuiFrame):
HYPERBOLIC_STATES = [
diff --git a/ndn/nfd.py b/ndn/nfd.py
index 6fea538..817e8d9 100644
--- a/ndn/nfd.py
+++ b/ndn/nfd.py
@@ -10,6 +10,8 @@
self.node = node
self.isRunning = False
+ self.logLevel = node.params["params"].get("nfd-log-level", "NONE")
+
# Create home directory for a node
node.cmd("cd /tmp && mkdir %s" % node.name)
node.cmd("cd %s" % node.name)
@@ -24,6 +26,9 @@
# Copy nfd.conf file from /usr/local/etc/mini-ndn to the node's home
node.cmd("sudo cp /usr/local/etc/mini-ndn/nfd.conf %s" % self.confFile)
+ # Set log level
+ node.cmd("sudo sed -i \'s|$LOG_LEVEL|%s|g\' %s" % (self.logLevel, self.confFile))
+
# Open the conf file and change socket file name
node.cmd("sudo sed -i 's|nfd.sock|%s.sock|g' %s" % (node.name, self.confFile))