Allow setting of log level in config file

Change-Id: I7fa88b5f095d161c09e5f5c19b094f2028c24391
diff --git a/xos/xos/logger.py b/xos/xos/logger.py
index 1f57a4a..7ebf87c 100644
--- a/xos/xos/logger.py
+++ b/xos/xos/logger.py
@@ -44,14 +44,22 @@
 class Logger:
 
     def __init__(self, logfile=None, loggername=None, level=logging.INFO):
+        logstash_level = logging.DEBUG
+        try:
+            config_level = Config().observer_log_level
+            if (config_level):
+                level = getattr(logging, config_level)
+                logstash_level = getattr(logging, config_level)
+        except:
+            pass
 
         # Logstash config - try as specified explicitly in config
         try:
             logstash_host, logstash_port = Config().observer_logstash_hostport.split(':')
             logstash_handler = logstash.LogstashHandler(
                 logstash_host, int(logstash_port), version=1)
-            # always log at DEBUG level to logstash
-            logstash_handler.setLevel(logging.DEBUG)
+
+            logstash_handler.setLevel(logstash_level)
         except:
             logstash_handler = None
 
@@ -61,7 +69,7 @@
                 logstash_handler = logstash.LogstashHandler(
                     "cordloghost", 5617, version=1)
                 # always log at DEBUG level to logstash
-                logstash_handler.setLevel(logging.DEBUG)
+                logstash_handler.setLevel(logstash_level)
             except:
                 logstash_handler = None