Skip to content

Commit

Permalink
Reinitialise loggers for each Clade instance
Browse files Browse the repository at this point in the history
  • Loading branch information
17451k committed Jul 23, 2021
1 parent 9308862 commit f5c2c96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions clade/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ def get_logger(name, with_name=True, conf=None):

logger = logging.getLogger(name)

if logger.handlers:
return logger
# Remove all old handlers
for handler in logger.handlers[:]:
logger.removeHandler(handler)

if with_name:
formatter = logging.Formatter("%(asctime)s clade {}: %(message)s".format(name), "%H:%M:%S")
Expand All @@ -49,7 +50,7 @@ def get_logger(name, with_name=True, conf=None):
file_handler = logging.FileHandler(log_file)
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
except PermissionError:
except (PermissionError, OSError):
# Can't write to clade.log file if working directory is read only
pass

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def finalize_options(self):

setuptools.setup(
name="clade",
version="3.4.5",
version="3.4.6",
author="Ilya Shchepetkov",
author_email="[email protected]",
url="https://github.com/17451k/clade",
Expand Down

0 comments on commit f5c2c96

Please sign in to comment.