From: Alfredo Deza Date: Mon, 9 Sep 2019 17:44:17 +0000 (-0400) Subject: ceph-volume create a logger for the terminal X-Git-Tag: v15.1.0~1616^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=95b16b516c0736839fe50f12ecbeb7cd62c67335;p=ceph.git ceph-volume create a logger for the terminal Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/log.py b/src/ceph-volume/ceph_volume/log.py index 890b6da1b7a..802b5fec290 100644 --- a/src/ceph-volume/ceph_volume/log.py +++ b/src/ceph-volume/ceph_volume/log.py @@ -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)