Skip to content

Commit

Permalink
fix(file_logger): create dirs if they don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
serhez committed Mar 7, 2024
1 parent a189ed7 commit c078467
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mloggers/file_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def __init__(self, file_path: str):

# Create the file if it does not exist
if not os.path.exists(file_path):
dir_path = os.path.dirname(file_path)
os.makedirs(dir_path)
with open(file_path, "w") as file:
file.write("")

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "mloggers"
version = "1.1.4"
version = "1.1.5"
authors = [
{ name = "Sergio Hernandez Gutierrez", email = "[email protected]" },
]
Expand Down

0 comments on commit c078467

Please sign in to comment.