Skip to content

Commit

Permalink
fix: Fix debug messages from logfile_enable
Browse files Browse the repository at this point in the history
  • Loading branch information
adigitoleo committed Aug 12, 2024
1 parent fd69400 commit 75c23fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pydrex/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,12 +783,13 @@ def logfile_enable(path, level: str | int = logging.DEBUG, mode="w"):
# Path can be an io.TextIOWrapper or io.StringIO, for testing purposes.
logger_file: logging.StreamHandler | logging.FileHandler
if isinstance(path, (io.StringIO, io.TextIOWrapper)):
_log.debug("enabling logging at %s level to IO stream")
logger_file = logging.StreamHandler(path)
logger_file.setFormatter(formatter)
logger_file.setLevel(level)
_log.LOGGER.addHandler(logger_file)
else:
_log.critical("%s", type(path))
_log.debug("enabling logging at %s level to %s", level, path)
logger_file = logging.FileHandler(resolve_path(path), mode=mode)
logger_file.setFormatter(formatter)
logger_file.setLevel(level)
Expand Down

0 comments on commit 75c23fd

Please sign in to comment.