]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume create a logger for the terminal
authorAlfredo Deza <adeza@redhat.com>
Mon, 9 Sep 2019 17:44:17 +0000 (13:44 -0400)
committerAlfredo Deza <adeza@redhat.com>
Tue, 10 Sep 2019 17:17:23 +0000 (13:17 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 95b16b516c0736839fe50f12ecbeb7cd62c67335)

src/ceph-volume/ceph_volume/log.py

index 890b6da1b7a5c04b01a6652e1f768c00b5aafc8f..802b5fec290dc2d703e8d4511ab2b794e5a5d046 100644 (file)
@@ -31,3 +31,18 @@ def setup(name='ceph-volume.log', log_path=None):
     fh.setFormatter(logging.Formatter(FILE_FORMAT))
 
     root_logger.addHandler(fh)
+
+
+def setup_console():
+    # TODO: At some point ceph-volume should stop using the custom logger
+    # interface that exists in terminal.py and use the logging module to
+    # produce output for the terminal
+    # Console Logger
+    sh = logging.StreamHandler()
+    sh.setFormatter(logging.Formatter('[terminal] %(message)s'))
+    sh.setLevel(logging.DEBUG)
+
+    terminal_logger = logging.getLogger('terminal')
+
+    # allow all levels at root_logger, handlers control individual levels
+    terminal_logger.addHandler(sh)