Skip to content

Commit d3bb483

Browse files
committed
Make sure the log directory and log file exist
1 parent 950c060 commit d3bb483

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

feature_gate/adapters/memory.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ class MemoryAdapter:
1212
def __init__(self):
1313
self._features = []
1414
bind_contextvars(klass="MemoryAdapter")
15+
log_path = Path("logs").joinpath("feature_gate").with_suffix(".log")
16+
Path.mkdir(Path("logs"), exist_ok=True)
17+
Path.touch(log_path)
1518
structlog.configure(
1619
processors=[
1720
merge_contextvars,
@@ -21,7 +24,7 @@ def __init__(self):
2124
structlog.processors.JSONRenderer(),
2225
],
2326
logger_factory=structlog.WriteLoggerFactory(
24-
file=Path("logs").joinpath("development").with_suffix(".log").open("wt")
27+
file=log_path.open("wt")
2528
),
2629
)
2730
self._logger = structlog.get_logger()

0 commit comments

Comments
 (0)