X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Flog.py;fp=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Flog.py;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=890b6da1b7a5c04b01a6652e1f768c00b5aafc8f;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/ceph-volume/ceph_volume/log.py b/src/ceph/src/ceph-volume/ceph_volume/log.py deleted file mode 100644 index 890b6da..0000000 --- a/src/ceph/src/ceph-volume/ceph_volume/log.py +++ /dev/null @@ -1,33 +0,0 @@ -import logging -import os -from ceph_volume import terminal -from ceph_volume import conf - -BASE_FORMAT = "[%(name)s][%(levelname)-6s] %(message)s" -FILE_FORMAT = "[%(asctime)s]" + BASE_FORMAT - - -def setup(name='ceph-volume.log', log_path=None): - log_path = log_path or conf.log_path - # if a non-root user calls help or other no-sudo-required command the - # logger will fail to write to /var/lib/ceph/ so this /tmp/ path is used as - # a fallback - tmp_log_file = os.path.join('/tmp/', name) - root_logger = logging.getLogger() - # The default path is where all ceph log files are, and will get rotated by - # Ceph's logrotate rules. - - root_logger.setLevel(logging.DEBUG) - - try: - fh = logging.FileHandler(log_path) - except (OSError, IOError) as err: - terminal.warning("Falling back to /tmp/ for logging. Can't use %s" % log_path) - terminal.warning(str(err)) - conf.log_path = tmp_log_file - fh = logging.FileHandler(tmp_log_file) - - fh.setLevel(logging.DEBUG) - fh.setFormatter(logging.Formatter(FILE_FORMAT)) - - root_logger.addHandler(fh)