From 374f64d8b1a3abb4bb03c1d872e5619de864c18c Mon Sep 17 00:00:00 2001 From: Cedric Leporcq Date: Mon, 18 Oct 2021 20:48:23 +0200 Subject: [PATCH] Change logger format for debug level and fixes --- ordigi/collection.py | 4 ++-- ordigi/log.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ordigi/collection.py b/ordigi/collection.py index 9f382f3..0e74abf 100644 --- a/ordigi/collection.py +++ b/ordigi/collection.py @@ -428,10 +428,10 @@ class Collection: self.logger.info(f'File {dest_path} already sorted') return None elif dest_path.is_dir(): - self.logger.warning(f'File {dest_path} is a existing directory') + self.logger.info(f'File {dest_path} is a existing directory') return False elif dest_path.is_file(): - self.logger.warning(f'File {dest_path} already exist') + self.logger.info(f'File {dest_path} already exist') if remove_duplicates: if filecmp.cmp(src_path, dest_path): self.logger.info( diff --git a/ordigi/log.py b/ordigi/log.py index 170d819..8aee994 100644 --- a/ordigi/log.py +++ b/ordigi/log.py @@ -11,7 +11,12 @@ def level(verbose, debug): def get_logger(name='ordigi', level=30): - logging.basicConfig(format='%(levelname)s:%(message)s', level=level) + if level > 10: + format='%(levelname)s:%(message)s' + else: + format='%(levelname)s:%(name)s:%(message)s' + + logging.basicConfig(format=format, level=level) logging.getLogger('asyncio').setLevel(level) logger = logging.getLogger(name) return logger