Skip to content

Commit

Permalink
Avoid adding duplicate log handler (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsimsek authored Aug 6, 2024
1 parent 6d34a71 commit 909a976
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pyliquibase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ def log(self):
if not self._log:
self._log = logging.getLogger("pyliquibase")
self._log.setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
self._log.addHandler(handler)
if not self._log.hasHandlers():
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
self._log.addHandler(handler)
return self._log

def _cli(self):
Expand Down

0 comments on commit 909a976

Please sign in to comment.