Skip to content

Commit

Permalink
fix: polished log commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jlerat committed Feb 14, 2024
1 parent 31a76b5 commit 9bb0a8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hydrodiy/io/iutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ def log_dict(self, tolog, name="", level="info"):
""" Add log entry for dictionnary (e.g. created from argparse using vars)"""
assert level in ["info", "warning", "critical", "error"]
logfun = getattr(self, level)
logfun("")
sep = self.get_separator("#", 10)
sep = self.get_separator("+", 20)
logfun(sep)
if name!="":
logfun(f"{name}:")
for k, v in tolog.items():
logfun(" "*4+f"{k} = {v}")

logfun(sep)
logfun("")



Expand Down
4 changes: 2 additions & 2 deletions hydrodiy/io/tests/test_hyio_iutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ def test_get_logger():
ck = ck & txt[5].strip().endswith("ERROR | error")
ck = ck & txt[6].strip().endswith("CRITICAL | critical")
ck = ck & txt[7].strip().endswith("WARNING | warning")
ck = ck & txt[10].strip().endswith("WARNING | test:")
ck = ck & txt[11].strip().endswith("WARNING | a = 1")
ck = ck & txt[9].strip().endswith("WARNING | test:")
ck = ck & txt[10].strip().endswith("WARNING | a = 1")
assert ck

# Test logging with different format
Expand Down

0 comments on commit 9bb0a8d

Please sign in to comment.