Skip to content

Commit bc3bc3f

Browse files
Merge pull request #62 from kevinbackhouse/log_dir
Make sure that the logs directory exists
2 parents b520df4 + ccab15d commit bc3bc3f

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
*.log
21
.direnv
32
.envrc
43

@@ -14,6 +13,9 @@ __pycache__/
1413
# C extensions
1514
*.so
1615

16+
# Logs directory
17+
logs/
18+
1719
# Distribution / packaging
1820
.Python
1921
build/

logs/ABOUT

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/seclab_taskflow_agent/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@
3838

3939
# only model output or help message should go to stdout, everything else goes to log
4040
logging.getLogger('').setLevel(logging.NOTSET)
41+
log_dir = pathlib.Path("logs")
42+
log_dir.mkdir(parents=True, exist_ok=True)
4143
log_file_handler = RotatingFileHandler(
42-
'logs/task_agent.log',
44+
log_dir.joinpath('task_agent.log'),
4345
maxBytes=1024*1024*10,
4446
backupCount=10)
4547
log_file_handler.setLevel(os.getenv('TASK_AGENT_LOGLEVEL', default='DEBUG'))

0 commit comments

Comments
 (0)