Skip to content

Commit

Permalink
[log] Only creates directory if not stdout (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldyfruit authored and JarbasAl committed Apr 18, 2023
1 parent 31746b2 commit 5f7987d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ovos_utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def init(cls, config=None):
cls.backup_count = config.get("backup_count", 3)
cls.level = config.get("level", "INFO")
cls.diagnostic_mode = config.get("diagnostic", False)
os.makedirs(cls.base_path, exist_ok=True)

@classmethod
def create_logger(cls, name, tostdout=True):
Expand All @@ -77,6 +76,7 @@ def create_logger(cls, name, tostdout=True):
logger.addHandler(stdout_handler)
# log to file
if cls.base_path != "stdout":
os.makedirs(cls.base_path, exist_ok=True)
path = join(cls.base_path,
cls.name.lower().strip() + ".log")
handler = RotatingFileHandler(path, maxBytes=cls.max_bytes,
Expand Down

0 comments on commit 5f7987d

Please sign in to comment.