Skip to content

Commit 4cff4ae

Browse files
committed
SQL LogType is not logged if APP_ENV = 'production'
1 parent 37a7a81 commit 4cff4ae

4 files changed

Lines changed: 7 additions & 90 deletions

File tree

backend/src/lib/job.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const sendClaimEmails = async (job: JobType, mysql: MySql) => {
181181
}
182182
}
183183

184-
writeLog(LogType.ERROR, updates);
184+
writeLog(LogType.SQL, updates);
185185

186186
if (updates.length > 0) {
187187
const sql = `

backend/src/lib/logger.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export function writeLog(
2828
functionSource = '',
2929
error?: Error,
3030
) {
31+
if (type === LogType.SQL && env.APP_ENV === 'production') {
32+
// Do not log SQL queries in production
33+
return;
34+
}
35+
3136
if (env.LOG_TARGET == 'console') {
3237
// setTheme({
3338
// info: [bgYellow, black],

backend/src/middlewares/claim.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ export function ClaimGuard(req: Request, _res: Response, next: NextFunction) {
4444
AuthorizationErrorCode.UNSUPPORTED_CLAIM_TYPE,
4545
context,
4646
`claim-middleware/validateRoute/${context.env.CLAIM_TYPE}`,
47-
),
47+
),
4848
);
4949
}

backend/src/middlewares/logger.ts

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)