Skip to content

Commit fbdc753

Browse files
committed
fix(apirequestlogger): create api-logs dir in log() if missing
Signed-off-by: Michael Cramer <michael@bigmichi1.de>
1 parent 53158f9 commit fbdc753

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/bot/utils/apiRequestLogger.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class ApiRequestLogger {
4444
response: { status: number; ok: boolean; body?: any; error?: string }
4545
): void {
4646
try {
47+
if (!fs.existsSync(API_LOGS_DIR)) {
48+
fs.mkdirSync(API_LOGS_DIR, { recursive: true });
49+
}
4750
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
4851
const userPart = userId ? userId.substring(0, 8) : 'system';
4952
const filename = `${userPart}_${action}_${timestamp}.json`;

0 commit comments

Comments
 (0)