Skip to content

Commit e7cab80

Browse files
committed
Don't create log files if one does not already exist.
1 parent 9e36608 commit e7cab80

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

agentstack/log.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,13 @@ def _build_logger() -> logging.Logger:
162162

163163
try:
164164
# `conf.PATH` can change during startup, so defer building the path
165-
# log file only gets written to if it exists, which happens on project init
166165
log_filename = conf.PATH / LOG_FILENAME
166+
167+
# log file only gets written to if it exists, which happens on project init
168+
# this prevents us from littering log files outside of project directories
169+
if not log_filename.exists():
170+
raise FileNotFoundError
171+
167172
file_handler = logging.FileHandler(log_filename)
168173
file_handler.setFormatter(FileFormatter())
169174
file_handler.setLevel(DEBUG)

0 commit comments

Comments
 (0)