Skip to content

Commit df00e25

Browse files
committed
fix: reduce log noise and prevent sensitive data logging
- Skip HTTP logging for health check and monitoring endpoints - Exclude /health, /, /websocket/status, /docs, /api/openapi.json - Reduces log volume from load balancer health checks - Log only field names instead of encrypted data in WebSocket note updates - Prevents Sentry from filtering encrypted content as [Filtered] - Changes log format from logging full objects to field names only - Fix prettier formatting in version.ts (add missing semicolon)
1 parent 4e278d2 commit df00e25

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# [1.11.0](https://github.com/typelets/typelets-api/compare/v1.10.0...v1.11.0) (2025-10-18)
22

3-
43
### Features
54

6-
* migrate to Sentry.io monitoring, upgrade to Node 22, add folders to Swagger docs ([f2189fd](https://github.com/typelets/typelets-api/commit/f2189fde28d8995623a3a7af178ec284062d357e))
5+
- migrate to Sentry.io monitoring, upgrade to Node 22, add folders to Swagger docs ([f2189fd](https://github.com/typelets/typelets-api/commit/f2189fde28d8995623a3a7af178ec284062d357e))
76

87
# [1.10.0](https://github.com/typelets/typelets-api/compare/v1.9.0...v1.10.0) (2025-10-18)
98

src/server.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,9 @@ import codeRouter from "./routes/code/crud";
3030
import { VERSION } from "./version";
3131
import { logger } from "./lib/logger";
3232

33-
// Type for OpenAPI routers
34-
interface OpenAPIRouter {
35-
getOpenAPIDocument: (config?: Record<string, unknown>) => {
36-
openapi?: string;
37-
info?: Record<string, unknown>;
38-
servers?: Array<Record<string, unknown>>;
39-
paths: Record<string, unknown>;
40-
components?: {
41-
schemas?: Record<string, unknown>;
42-
securitySchemes?: Record<string, unknown>;
43-
};
44-
};
45-
}
33+
// Type for OpenAPI routers - using permissive any to avoid type conflicts with library internals
34+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
35+
type OpenAPIRouter = any;
4636

4737
const maxFileSize = process.env.MAX_FILE_SIZE_MB ? parseInt(process.env.MAX_FILE_SIZE_MB) : 50;
4838
const maxBodySize = Math.ceil(maxFileSize * 1.35);
@@ -70,9 +60,16 @@ app.use("*", async (c, next) => {
7060
const duration = Date.now() - start;
7161
const status = c.res.status;
7262

63+
// Skip logging for health check and monitoring endpoints
64+
const skipLogging = ["/health", "/", "/websocket/status", "/docs", "/api/openapi.json"].includes(
65+
path
66+
);
67+
7368
// Log HTTP request with structured logging
74-
const userId = c.get("userId");
75-
logger.httpRequest(method, path, status, duration, userId);
69+
if (!skipLogging) {
70+
const userId = c.get("userId");
71+
logger.httpRequest(method, path, status, duration, userId);
72+
}
7673

7774
if (isDevelopment) {
7875
const emoji =

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// This file is automatically updated by semantic-release
2-
export const VERSION = "1.11.0"
2+
export const VERSION = "1.11.0";

src/websocket/handlers/notes.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ export class NoteHandler extends BaseResourceHandler {
144144
});
145145

146146
if (Object.keys(filteredChanges).length > 0) {
147-
console.log(`Note update: applying changes to note ${message.noteId}:`, filteredChanges);
147+
console.log(
148+
`Note update: applying changes to note ${message.noteId}, fields: ${Object.keys(filteredChanges).join(", ")}`
149+
);
148150
filteredChanges.updatedAt = new Date();
149151

150152
const [updatedNote] = await db
@@ -183,8 +185,7 @@ export class NoteHandler extends BaseResourceHandler {
183185
);
184186
} else {
185187
console.warn(
186-
`Note update: no valid changes found for note ${message.noteId}, original changes:`,
187-
message.changes
188+
`Note update: no valid changes found for note ${message.noteId}, attempted fields: ${Object.keys(message.changes || {}).join(", ")}`
188189
);
189190
ws.send(
190191
JSON.stringify({

0 commit comments

Comments
 (0)