feat(CF-2136): Add Sentry structured logging support
Enable enableLogs + beforeSendLog in Sentry.init, add log helpers where applicable. Bump @sentry/node to ^10.39.0 for Sentry.logger API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,11 @@ export function initSentry(environment: string = "development"): void {
|
|||||||
|
|
||||||
return event;
|
return event;
|
||||||
},
|
},
|
||||||
|
enableLogs: true,
|
||||||
|
beforeSendLog(log) {
|
||||||
|
if (log.level === "debug") return null;
|
||||||
|
return log;
|
||||||
|
},
|
||||||
maxBreadcrumbs: 30,
|
maxBreadcrumbs: 30,
|
||||||
attachStacktrace: true,
|
attachStacktrace: true,
|
||||||
release: process.env.APP_VERSION || "unknown",
|
release: process.env.APP_VERSION || "unknown",
|
||||||
@@ -62,6 +67,18 @@ export function initSentry(environment: string = "development"): void {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function logInfo(msg: string, data?: Record<string, unknown>): void {
|
||||||
|
Sentry.logger.info(msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function logWarn(msg: string, data?: Record<string, unknown>): void {
|
||||||
|
Sentry.logger.warn(msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function logError(msg: string, data?: Record<string, unknown>): void {
|
||||||
|
Sentry.logger.error(msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
export async function withSentryTransaction<T>(
|
export async function withSentryTransaction<T>(
|
||||||
toolName: string,
|
toolName: string,
|
||||||
handler: () => Promise<T>
|
handler: () => Promise<T>
|
||||||
|
|||||||
Reference in New Issue
Block a user