Skip to content

Commit

Permalink
Don't duplicate logger hander (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
sayler authored Oct 5, 2020
1 parent 0ac97d6 commit e8919e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion almdrlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def set_logger(name='almdrlib', level=logging.DEBUG, format_string=None):
handler.setLevel(level)
formatter = logging.Formatter(format_string)
handler.setFormatter(formatter)
logger.addHandler(handler)

# avoid duplicate logs if already set by caller, etc.
if not logger.handlers:
logger.addHandler(handler)


def _get_default_session():
Expand Down

0 comments on commit e8919e5

Please sign in to comment.