Skip to content

Commit ede401f

Browse files
committed
Expand ~ in provided log_file and ensure parent directory is created
1 parent c42ee07 commit ede401f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

brain_core/logging_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ def setup_logging(
7676
log_dir = Path.home() / ".brain" / "logs"
7777
log_dir.mkdir(parents=True, exist_ok=True)
7878
log_file = log_dir / "brain.log"
79+
else:
80+
# Expand ~ in path and ensure parent directory exists
81+
log_file = Path(log_file).expanduser()
82+
log_file.parent.mkdir(parents=True, exist_ok=True)
7983

8084
# Rotating file handler: max 10MB per file, keep 5 backup files
8185
# This means max ~50MB of logs total (10MB current + 5x10MB backups)

0 commit comments

Comments
 (0)