Skip to content

Commit 76f8f31

Browse files
author
harvey_xiang
committed
feat: log support time rotating
1 parent 307e06a commit 76f8f31

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/memos/log.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ def _setup_logfile() -> Path:
3434
3535
Returns: the logfile Path
3636
"""
37-
today_str = time.strftime("%Y-%m-%d", time.localtime())
38-
today_file_name = f"{today_str}.memos.log"
39-
today_file = Path(settings.MEMOS_DIR / "logs" / today_file_name)
40-
today_file.parent.mkdir(parents=True, exist_ok=True)
37+
logfile = Path(settings.MEMOS_DIR / "logs" / "memos.log")
38+
logfile.parent.mkdir(parents=True, exist_ok=True)
39+
logfile.touch(exist_ok=True)
4140

42-
return today_file
41+
return logfile
4342

4443

4544
class ContextFilter(logging.Filter):

0 commit comments

Comments
 (0)