Skip to content

Commit

Permalink
Modify log to be more general
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwen committed Sep 22, 2021
1 parent 4f28521 commit 7531ddb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kliff/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
LOG_LEVEL = None


def set_logger(level: str = "INFO", stderr: bool = True):
def set_logger(level: str = "INFO", filename: str = "kliff.log", stderr: bool = True):
"""
Set up loguru loggers.
Expand All @@ -15,12 +15,13 @@ def set_logger(level: str = "INFO", stderr: bool = True):
Args:
level: log level, e.g. DEBUG, INFO, WARNING, ERROR, and CRITICAL.
filename: name of the file to log to
stderr: whether to log to stderr.
"""
global LOG_LEVEL
LOG_LEVEL = level

file_handler = {"sink": "kliff.log", "level": level}
file_handler = {"sink": filename, "level": level}
stderr_handler = {"sink": sys.stderr, "level": level}

if stderr:
Expand Down

0 comments on commit 7531ddb

Please sign in to comment.