Update odltools
[netvirt.git] / resources / tools / odltools / odltools / logg.py
index 50f937d912c85fe2424a9752595d3ed54a11dd14..c3f05825ef51921a688df496bd479ea6935d7c65 100644 (file)
@@ -1,8 +1,35 @@
+# Copyright 2018 Red Hat, Inc. and others. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 import logging
 
+logger = None
+ch = None
+fh = None
+
+
+def debug():
+    ch.setLevel(logging.DEBUG)
+    # logger.setLevel(min([ch.level, fh.level]))
+
 
 class Logger:
     def __init__(self, console_level=logging.INFO, file_level=logging.DEBUG):
+        global logger
+        global ch
+        global fh
+
         logger = logging.getLogger()
         formatter = logging.Formatter('%(asctime)s | %(levelname).3s | %(name)-20s | %(lineno)04d | %(message)s')
         ch = logging.StreamHandler()