diff --git a/dev-packages/node-integration-tests/package.json b/dev-packages/node-integration-tests/package.json index ae13c63e01f3..24e25243773e 100644 --- a/dev-packages/node-integration-tests/package.json +++ b/dev-packages/node-integration-tests/package.json @@ -39,6 +39,7 @@ "apollo-server": "^3.11.1", "body-parser": "^1.20.3", "connect": "^3.7.0", + "consola": "^3.2.3", "cors": "^2.8.5", "cron": "^3.1.6", "dataloader": "2.2.2", diff --git a/dev-packages/node-integration-tests/suites/consola/subject-args.ts b/dev-packages/node-integration-tests/suites/consola/subject-args.ts new file mode 100644 index 000000000000..a4d6e72ecd0c --- /dev/null +++ b/dev-packages/node-integration-tests/suites/consola/subject-args.ts @@ -0,0 +1,31 @@ +import * as Sentry from '@sentry/node'; +import { loggingTransport } from '@sentry-internal/node-integration-tests'; +import { consola } from 'consola'; + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + release: '1.0.0', + environment: 'test', + enableLogs: true, + transport: loggingTransport, +}); + +async function run(): Promise { + // Set consola level to capture all logs including debug and trace + consola.level = 5; + + // Create a Sentry reporter for consola + const sentryReporter = Sentry.createConsolaReporter(); + + // Add the reporter to consola + consola.addReporter(sentryReporter); + + // Test with arguments formatting + consola.info('Message with args:', 'hello', 123, { key: 'value' }, [1, 2, 3]); + consola.error('Error with object:', new Error('Test error')); + + await Sentry.flush(); +} + +// eslint-disable-next-line @typescript-eslint/no-floating-promises +void run(); diff --git a/dev-packages/node-integration-tests/suites/consola/subject-custom-levels.ts b/dev-packages/node-integration-tests/suites/consola/subject-custom-levels.ts new file mode 100644 index 000000000000..3f3690f7d110 --- /dev/null +++ b/dev-packages/node-integration-tests/suites/consola/subject-custom-levels.ts @@ -0,0 +1,30 @@ +import * as Sentry from '@sentry/node'; +import { loggingTransport } from '@sentry-internal/node-integration-tests'; +import { consola } from 'consola'; + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + release: '1.0.0', + environment: 'test', + enableLogs: true, + transport: loggingTransport, +}); + +async function run(): Promise { + // Test custom levels filtering + const customReporter = Sentry.createConsolaReporter({ + levels: ['error', 'warn'], // Only capture errors and warnings + }); + + // Add the custom reporter to consola + consola.addReporter(customReporter); + + consola.info('This should not be captured'); + consola.warn('This should be captured'); + consola.error('This should also be captured'); + + await Sentry.flush(); +} + +// eslint-disable-next-line @typescript-eslint/no-floating-promises +void run(); diff --git a/dev-packages/node-integration-tests/suites/consola/subject-levels.ts b/dev-packages/node-integration-tests/suites/consola/subject-levels.ts new file mode 100644 index 000000000000..02052febfb65 --- /dev/null +++ b/dev-packages/node-integration-tests/suites/consola/subject-levels.ts @@ -0,0 +1,32 @@ +import * as Sentry from '@sentry/node'; +import { loggingTransport } from '@sentry-internal/node-integration-tests'; +import { consola } from 'consola'; + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + release: '1.0.0', + environment: 'test', + enableLogs: true, + transport: loggingTransport, +}); + +async function run(): Promise { + // Set consola level to capture all logs including debug and trace + consola.level = 5; + + // Create a Sentry reporter for consola + const sentryReporter = Sentry.createConsolaReporter(); + + // Add the reporter to consola + consola.addReporter(sentryReporter); + + // Test level-based logging - test some basic level mappings by using different log methods + consola.fatal('Fatal level message'); + consola.warn('Warning level message'); + consola.info('Info level message'); + + await Sentry.flush(); +} + +// eslint-disable-next-line @typescript-eslint/no-floating-promises +void run(); diff --git a/dev-packages/node-integration-tests/suites/consola/subject-tags.ts b/dev-packages/node-integration-tests/suites/consola/subject-tags.ts new file mode 100644 index 000000000000..ca458a68a068 --- /dev/null +++ b/dev-packages/node-integration-tests/suites/consola/subject-tags.ts @@ -0,0 +1,32 @@ +import * as Sentry from '@sentry/node'; +import { loggingTransport } from '@sentry-internal/node-integration-tests'; +import { consola } from 'consola'; + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + release: '1.0.0', + environment: 'test', + enableLogs: true, + transport: loggingTransport, +}); + +async function run(): Promise { + // Set consola level to capture all logs including debug and trace + consola.level = 5; + + // Create a Sentry reporter for consola + const sentryReporter = Sentry.createConsolaReporter(); + + // Add the reporter to consola + consola.addReporter(sentryReporter); + + // Test with scoped logger (tags) + const taggedLogger = consola.withTag('api'); + taggedLogger.info('Tagged info message'); + taggedLogger.error('Tagged error message'); + + await Sentry.flush(); +} + +// eslint-disable-next-line @typescript-eslint/no-floating-promises +void run(); diff --git a/dev-packages/node-integration-tests/suites/consola/subject-types.ts b/dev-packages/node-integration-tests/suites/consola/subject-types.ts new file mode 100644 index 000000000000..fc63c38cf614 --- /dev/null +++ b/dev-packages/node-integration-tests/suites/consola/subject-types.ts @@ -0,0 +1,42 @@ +import * as Sentry from '@sentry/node'; +import { loggingTransport } from '@sentry-internal/node-integration-tests'; +import { consola } from 'consola'; + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + release: '1.0.0', + environment: 'test', + enableLogs: true, + transport: loggingTransport, +}); + +async function run(): Promise { + // Set consola level to capture all logs including debug, trace, and verbose + consola.level = Number.POSITIVE_INFINITY; + + // Create a Sentry reporter for consola + const sentryReporter = Sentry.createConsolaReporter(); + + // Add the reporter to consola + consola.addReporter(sentryReporter); + + // Test basic logging with different types + consola.info('Test info message'); + consola.error('Test error message'); + consola.warn('Test warn message'); + + // Test different consola log types + consola.success('Test success message'); + consola.fail('Test fail message'); + consola.ready('Test ready message'); + consola.start('Test start message'); + consola.box('Test box message'); + consola.verbose('Test verbose message'); + consola.debug('Test debug message'); + consola.trace('Test trace message'); + + await Sentry.flush(); +} + +// eslint-disable-next-line @typescript-eslint/no-floating-promises +void run(); diff --git a/dev-packages/node-integration-tests/suites/consola/subject.ts b/dev-packages/node-integration-tests/suites/consola/subject.ts new file mode 100644 index 000000000000..834aac57d993 --- /dev/null +++ b/dev-packages/node-integration-tests/suites/consola/subject.ts @@ -0,0 +1,32 @@ +import * as Sentry from '@sentry/node'; +import { loggingTransport } from '@sentry-internal/node-integration-tests'; +import { consola } from 'consola'; + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + release: '1.0.0', + environment: 'test', + enableLogs: true, + transport: loggingTransport, +}); + +async function run(): Promise { + // Set consola level to capture all logs including debug and trace + consola.level = 5; + + // Create a Sentry reporter for consola + const sentryReporter = Sentry.createConsolaReporter(); + + // Add the reporter to consola + consola.addReporter(sentryReporter); + + // Test basic logging with different types + consola.info('Test info message'); + consola.error('Test error message'); + consola.warn('Test warn message'); + + await Sentry.flush(); +} + +// eslint-disable-next-line @typescript-eslint/no-floating-promises +void run(); diff --git a/dev-packages/node-integration-tests/suites/consola/test.ts b/dev-packages/node-integration-tests/suites/consola/test.ts new file mode 100644 index 000000000000..05692d5a229d --- /dev/null +++ b/dev-packages/node-integration-tests/suites/consola/test.ts @@ -0,0 +1,482 @@ +import { afterAll, describe, expect, test } from 'vitest'; +import { cleanupChildProcesses, createRunner } from '../../utils/runner'; + +describe('consola integration', () => { + afterAll(() => { + cleanupChildProcesses(); + }); + + test('should capture consola logs with default levels', async () => { + const runner = createRunner(__dirname, 'subject.ts') + .expect({ + log: { + items: [ + { + timestamp: expect.any(Number), + level: 'info', + body: 'Test info message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'info', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'error', + body: 'Test error message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'error', type: 'string' }, + 'consola.level': { value: 0, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'warn', + body: 'Test warn message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'warn', type: 'string' }, + 'consola.level': { value: 1, type: 'integer' }, + }, + }, + ], + }, + }) + .start(); + + await runner.completed(); + }); + + test('should capture different consola log types', async () => { + const runner = createRunner(__dirname, 'subject-types.ts') + .expect({ + log: { + items: [ + // Basic logs from default test + { + timestamp: expect.any(Number), + level: 'info', + body: 'Test info message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'info', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'error', + body: 'Test error message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'error', type: 'string' }, + 'consola.level': { value: 0, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'warn', + body: 'Test warn message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'warn', type: 'string' }, + 'consola.level': { value: 1, type: 'integer' }, + }, + }, + // Consola-specific log types + { + timestamp: expect.any(Number), + level: 'info', + body: 'Test success message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'success', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'error', + body: 'Test fail message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'fail', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'info', + body: 'Test ready message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'ready', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'info', + body: 'Test start message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'start', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'info', + body: 'Test box message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'box', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'debug', + body: 'Test verbose message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'verbose', type: 'string' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'debug', + body: 'Test debug message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'debug', type: 'string' }, + 'consola.level': { value: 4, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'trace', + body: 'Test trace message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'trace', type: 'string' }, + 'consola.level': { value: 5, type: 'integer' }, + }, + }, + ], + }, + }) + .start(); + + await runner.completed(); + }); + + test('should capture consola logs with arguments formatting', async () => { + const runner = createRunner(__dirname, 'subject-args.ts') + .expect({ + log: { + items: expect.arrayContaining([ + { + timestamp: expect.any(Number), + level: 'info', + body: expect.stringContaining('Message with args: hello 123'), + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'info', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'error', + body: expect.stringContaining('Error with object:'), + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'error', type: 'string' }, + 'consola.level': { value: 0, type: 'integer' }, + }, + }, + ]), + }, + }) + .start(); + + await runner.completed(); + }); + + test('should capture consola logs with tags', async () => { + const runner = createRunner(__dirname, 'subject-tags.ts') + .expect({ + log: { + items: expect.arrayContaining([ + { + timestamp: expect.any(Number), + level: 'info', + body: 'Tagged info message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.tag': { value: 'api', type: 'string' }, + 'consola.type': { value: 'info', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'error', + body: 'Tagged error message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.tag': { value: 'api', type: 'string' }, + 'consola.type': { value: 'error', type: 'string' }, + 'consola.level': { value: 0, type: 'integer' }, + }, + }, + ]), + }, + }) + .start(); + + await runner.completed(); + }); + + test('should respect custom level filtering', async () => { + const runner = createRunner(__dirname, 'subject-custom-levels.ts') + .expect({ + log: { + items: expect.arrayContaining([ + // Should capture the warn message + { + timestamp: expect.any(Number), + level: 'warn', + body: 'This should be captured', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'warn', type: 'string' }, + 'consola.level': { value: 1, type: 'integer' }, + }, + }, + // Should capture the error message + { + timestamp: expect.any(Number), + level: 'error', + body: 'This should also be captured', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'error', type: 'string' }, + 'consola.level': { value: 0, type: 'integer' }, + }, + }, + ]), + }, + }) + .start(); + + await runner.completed(); + }); + + test('should capture different consola level methods', async () => { + const runner = createRunner(__dirname, 'subject-levels.ts') + .expect({ + log: { + items: expect.arrayContaining([ + { + timestamp: expect.any(Number), + level: 'fatal', + body: 'Fatal level message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'fatal', type: 'string' }, + 'consola.level': { value: 0, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'warn', + body: 'Warning level message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'warn', type: 'string' }, + 'consola.level': { value: 1, type: 'integer' }, + }, + }, + { + timestamp: expect.any(Number), + level: 'info', + body: 'Info level message', + severity_number: expect.any(Number), + trace_id: expect.any(String), + attributes: { + 'sentry.origin': { value: 'auto.logging.consola', type: 'string' }, + 'sentry.release': { value: '1.0.0', type: 'string' }, + 'sentry.environment': { value: 'test', type: 'string' }, + 'sentry.sdk.name': { value: 'sentry.javascript.node', type: 'string' }, + 'sentry.sdk.version': { value: expect.any(String), type: 'string' }, + 'server.address': { value: expect.any(String), type: 'string' }, + 'consola.type': { value: 'info', type: 'string' }, + 'consola.level': { value: 3, type: 'integer' }, + }, + }, + ]), + }, + }) + .start(); + + await runner.completed(); + }); +}); diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index 3b2f589f7fc2..49aa3d80cc5b 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -139,6 +139,7 @@ export { profiler, logger, consoleLoggingIntegration, + createConsolaReporter, wrapMcpServerWithSentry, NODE_VERSION, featureFlagsIntegration, diff --git a/packages/aws-serverless/src/index.ts b/packages/aws-serverless/src/index.ts index 8cbcd31c50a5..8fa3f7b38e20 100644 --- a/packages/aws-serverless/src/index.ts +++ b/packages/aws-serverless/src/index.ts @@ -125,6 +125,7 @@ export { vercelAIIntegration, logger, consoleLoggingIntegration, + createConsolaReporter, wrapMcpServerWithSentry, NODE_VERSION, featureFlagsIntegration, diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index 0bc523506454..35de77f611d0 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -16,6 +16,7 @@ export { extraErrorDataIntegration, rewriteFramesIntegration, consoleLoggingIntegration, + createConsolaReporter, } from '@sentry/core'; export { replayIntegration, getReplay } from '@sentry-internal/replay'; diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index b9af910eb0f1..f2c8b7c05a3b 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -143,6 +143,7 @@ export { vercelAIIntegration, logger, consoleLoggingIntegration, + createConsolaReporter, createSentryWinstonTransport, wrapMcpServerWithSentry, featureFlagsIntegration, diff --git a/packages/cloudflare/src/index.ts b/packages/cloudflare/src/index.ts index 23e902c4dc2e..d71f589d1ade 100644 --- a/packages/cloudflare/src/index.ts +++ b/packages/cloudflare/src/index.ts @@ -93,6 +93,7 @@ export { updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, + createConsolaReporter, featureFlagsIntegration, } from '@sentry/core'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index f81a6937d89c..ab7e1965775c 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -120,6 +120,7 @@ export { captureFeedback } from './feedback'; export type { ReportDialogOptions } from './report-dialog'; export { _INTERNAL_captureLog, _INTERNAL_flushLogsBuffer, _INTERNAL_captureSerializedLog } from './logs/exports'; export { consoleLoggingIntegration } from './logs/console-integration'; +export { createConsolaReporter } from './integrations/consola'; export { addVercelAiProcessors } from './utils/vercel-ai'; export { instrumentOpenAiClient } from './utils/openai'; export { OPENAI_INTEGRATION_NAME } from './utils/openai/constants'; diff --git a/packages/core/src/integrations/consola.ts b/packages/core/src/integrations/consola.ts new file mode 100644 index 000000000000..ae24d18a37da --- /dev/null +++ b/packages/core/src/integrations/consola.ts @@ -0,0 +1,296 @@ +import type { Client } from '../client'; +import { getClient } from '../currentScopes'; +import { _INTERNAL_captureLog } from '../logs/exports'; +import { formatConsoleArgs } from '../logs/utils'; +import type { LogSeverityLevel } from '../types-hoist/log'; + +/** + * Options for the Sentry Consola reporter. + */ +interface ConsolaReporterOptions { + /** + * Use this option to filter which levels should be captured. By default, all levels are captured. + * + * @example + * ```ts + * const sentryReporter = Sentry.createConsolaReporter({ + * // Only capture error and warn logs + * levels: ['error', 'warn'], + * }); + * consola.addReporter(sentryReporter); + * ``` + */ + levels?: Array; + + /** + * Optionally provide a specific Sentry client instance to use for capturing logs. + * If not provided, the current client will be retrieved using `getClient()`. + * + * This is useful when you want to use specific client options for log normalization + * or when working with multiple client instances. + * + * @example + * ```ts + * const sentryReporter = Sentry.createConsolaReporter({ + * client: myCustomClient, + * }); + * ``` + */ + client?: Client; +} + +export interface ConsolaReporter { + log: (logObj: ConsolaLogObject) => void; +} + +/** + * Represents a log object that Consola reporters receive. + * + * This interface matches the structure of log objects passed to Consola reporters. + * See: https://github.com/unjs/consola#custom-reporters + * + * @example + * ```ts + * const reporter = { + * log(logObj: ConsolaLogObject) { + * console.log(`[${logObj.type}] ${logObj.message || logObj.args?.join(' ')}`); + * } + * }; + * consola.addReporter(reporter); + * ``` + */ +export interface ConsolaLogObject { + /** + * The numeric log level (0-5) or null. + * + * Consola log levels: + * - 0: Fatal and Error + * - 1: Warnings + * - 2: Normal logs + * - 3: Informational logs, success, fail, ready, start, box, ... + * - 4: Debug logs + * - 5: Trace logs + * - null: Some special types like 'verbose' + * + * See: https://github.com/unjs/consola/blob/main/README.md#log-level + */ + level?: number | null; + + /** + * The log type/method name (e.g., 'error', 'warn', 'info', 'debug', 'trace', 'success', 'fail', etc.). + * + * Consola built-in types include: + * - Standard: silent, fatal, error, warn, log, info, success, fail, ready, start, box, debug, trace, verbose + * - Custom types can also be defined + * + * See: https://github.com/unjs/consola/blob/main/README.md#log-types + */ + type?: string; + + /** + * An optional tag/scope for the log entry. + * + * Tags are created using `consola.withTag('scope')` and help categorize logs. + * + * @example + * ```ts + * const scopedLogger = consola.withTag('auth'); + * scopedLogger.info('User logged in'); // tag will be 'auth' + * ``` + * + * See: https://github.com/unjs/consola/blob/main/README.md#withtagtag + */ + tag?: string; + + /** + * The raw arguments passed to the log method. + * + * When `message` is not provided, these args are typically formatted into the final message. + * + * @example + * ```ts + * consola.info('Hello', 'world', { user: 'john' }); + * // args = ['Hello', 'world', { user: 'john' }] + * ``` + */ + args?: unknown[]; + + /** + * The timestamp when the log was created. + * + * This is automatically set by Consola when the log is created. + */ + date?: Date; + + /** + * The formatted log message. + * + * When provided, this is the final formatted message. When not provided, + * the message should be constructed from the `args` array. + */ + message?: string; +} + +const DEFAULT_CAPTURED_LEVELS: Array = ['trace', 'debug', 'info', 'warn', 'error', 'fatal']; + +/** + * Creates a new Sentry reporter for Consola that forwards logs to Sentry. Requires the `enableLogs` option to be enabled. + * + * **Note: This integration supports Consola v3.x only.** The reporter interface and log object structure + * may differ in other versions of Consola. + * + * @param options - Configuration options for the reporter. + * @returns A Consola reporter that can be added to consola instances. + * + * @experimental This method will experience breaking changes. This is not yet part of + * the stable Sentry SDK API and can be changed or removed without warning. + * + * @example + * ```ts + * import * as Sentry from '@sentry/node'; + * import { consola } from 'consola'; + * + * Sentry.init({ + * enableLogs: true, + * }); + * + * const sentryReporter = Sentry.createConsolaReporter({ + * // Optional: filter levels to capture + * levels: ['error', 'warn', 'info'], + * }); + * + * consola.addReporter(sentryReporter); + * + * // Now consola logs will be captured by Sentry + * consola.info('This will be sent to Sentry'); + * consola.error('This error will also be sent to Sentry'); + * ``` + */ +export function createConsolaReporter(options: ConsolaReporterOptions = {}): ConsolaReporter { + const levels = new Set(options.levels ?? DEFAULT_CAPTURED_LEVELS); + const providedClient = options.client; + + return { + log({ type, level, message: consolaMessage, args, tag }: ConsolaLogObject) { + // Get client - use provided client or current client + const client = providedClient || getClient(); + if (!client) { + return; + } + + // Determine the log severity level + const logSeverityLevel = getLogSeverityLevel(type, level); + + // Early exit if this level should not be captured + if (!levels.has(logSeverityLevel)) { + return; + } + + const { normalizeDepth = 3, normalizeMaxBreadth = 1_000 } = client.getOptions(); + + // Format the log message using the same approach as consola's basic reporter + const messageParts = []; + if (consolaMessage) { + messageParts.push(consolaMessage); + } + if (args && args.length > 0) { + messageParts.push(formatConsoleArgs(args, normalizeDepth, normalizeMaxBreadth)); + } + const message = messageParts.join(' '); + + // Build attributes + const attributes: Record = { + 'sentry.origin': 'auto.logging.consola', + }; + + if (tag) { + attributes['consola.tag'] = tag; + } + + if (type) { + attributes['consola.type'] = type; + } + + // Only add level if it's a valid number (not null/undefined) + if (level != null && typeof level === 'number') { + attributes['consola.level'] = level; + } + + _INTERNAL_captureLog({ + level: logSeverityLevel, + message, + attributes, + }); + }, + }; +} + +// Mapping from consola log types to Sentry log severity levels +const CONSOLA_TYPE_TO_LOG_SEVERITY_LEVEL_MAP: Record = { + // Consola built-in types + silent: 'trace', + fatal: 'fatal', + error: 'error', + warn: 'warn', + log: 'info', + info: 'info', + success: 'info', + fail: 'error', + ready: 'info', + start: 'info', + box: 'info', + debug: 'debug', + trace: 'trace', + verbose: 'debug', + // Custom types that might exist + critical: 'fatal', + notice: 'info', +}; + +// Mapping from consola log levels (numbers) to Sentry log severity levels +const CONSOLA_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP: Record = { + 0: 'fatal', // Fatal and Error + 1: 'warn', // Warnings + 2: 'info', // Normal logs + 3: 'info', // Informational logs, success, fail, ready, start, ... + 4: 'debug', // Debug logs + 5: 'trace', // Trace logs +}; + +/** + * Determines the log severity level from Consola type and level. + * + * @param type - The Consola log type (e.g., 'error', 'warn', 'info') + * @param level - The Consola numeric log level (0-5) or null for some types like 'verbose' + * @returns The corresponding Sentry log severity level + */ +function getLogSeverityLevel(type?: string, level?: number | null): LogSeverityLevel { + // Handle special case for verbose logs (level can be null with infinite level in Consola) + if (type === 'verbose') { + return 'debug'; + } + + // Handle silent logs - these should be at trace level + if (type === 'silent') { + return 'trace'; + } + + // First try to map by type (more specific) + if (type) { + const mappedLevel = CONSOLA_TYPE_TO_LOG_SEVERITY_LEVEL_MAP[type]; + if (mappedLevel) { + return mappedLevel; + } + } + + // Fallback to level mapping (handle null level) + if (typeof level === 'number') { + const mappedLevel = CONSOLA_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP[level]; + if (mappedLevel) { + return mappedLevel; + } + } + + // Default fallback + return 'info'; +} diff --git a/packages/core/src/logs/console-integration.ts b/packages/core/src/logs/console-integration.ts index a69d406a659c..6c967499800f 100644 --- a/packages/core/src/logs/console-integration.ts +++ b/packages/core/src/logs/console-integration.ts @@ -6,21 +6,13 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; import type { ConsoleLevel } from '../types-hoist/instrument'; import type { IntegrationFn } from '../types-hoist/integration'; import { CONSOLE_LEVELS, debug } from '../utils/debug-logger'; -import { isPrimitive } from '../utils/is'; -import { normalize } from '../utils/normalize'; -import { GLOBAL_OBJ } from '../utils/worldwide'; import { _INTERNAL_captureLog } from './exports'; +import { formatConsoleArgs } from './utils'; interface CaptureConsoleOptions { levels: ConsoleLevel[]; } -type GlobalObjectWithUtil = typeof GLOBAL_OBJ & { - util: { - format: (...args: unknown[]) => string; - }; -}; - const INTEGRATION_NAME = 'ConsoleLogs'; const DEFAULT_ATTRIBUTES = { @@ -89,17 +81,3 @@ const _consoleLoggingIntegration = ((options: Partial = { * ``` */ export const consoleLoggingIntegration = defineIntegration(_consoleLoggingIntegration); - -function formatConsoleArgs(values: unknown[], normalizeDepth: number, normalizeMaxBreadth: number): string { - return 'util' in GLOBAL_OBJ && typeof (GLOBAL_OBJ as GlobalObjectWithUtil).util.format === 'function' - ? (GLOBAL_OBJ as GlobalObjectWithUtil).util.format(...values) - : safeJoinConsoleArgs(values, normalizeDepth, normalizeMaxBreadth); -} - -function safeJoinConsoleArgs(values: unknown[], normalizeDepth: number, normalizeMaxBreadth: number): string { - return values - .map(value => - isPrimitive(value) ? String(value) : JSON.stringify(normalize(value, normalizeDepth, normalizeMaxBreadth)), - ) - .join(' '); -} diff --git a/packages/core/src/logs/utils.ts b/packages/core/src/logs/utils.ts new file mode 100644 index 000000000000..c30bfd75530b --- /dev/null +++ b/packages/core/src/logs/utils.ts @@ -0,0 +1,39 @@ +import { isPrimitive } from '../utils/is'; +import { normalize } from '../utils/normalize'; +import { GLOBAL_OBJ } from '../utils/worldwide'; + +type GlobalObjectWithUtil = typeof GLOBAL_OBJ & { + util: { + format: (...args: unknown[]) => string; + }; +}; + +/** + * Formats the given values into a string. + * + * @param values - The values to format. + * @param normalizeDepth - The depth to normalize the values. + * @param normalizeMaxBreadth - The max breadth to normalize the values. + * @returns The formatted string. + */ +export function formatConsoleArgs(values: unknown[], normalizeDepth: number, normalizeMaxBreadth: number): string { + return 'util' in GLOBAL_OBJ && typeof (GLOBAL_OBJ as GlobalObjectWithUtil).util.format === 'function' + ? (GLOBAL_OBJ as GlobalObjectWithUtil).util.format(...values) + : safeJoinConsoleArgs(values, normalizeDepth, normalizeMaxBreadth); +} + +/** + * Joins the given values into a string. + * + * @param values - The values to join. + * @param normalizeDepth - The depth to normalize the values. + * @param normalizeMaxBreadth - The max breadth to normalize the values. + * @returns The joined string. + */ +export function safeJoinConsoleArgs(values: unknown[], normalizeDepth: number, normalizeMaxBreadth: number): string { + return values + .map(value => + isPrimitive(value) ? String(value) : JSON.stringify(normalize(value, normalizeDepth, normalizeMaxBreadth)), + ) + .join(' '); +} diff --git a/packages/core/test/lib/integrations/consola.test.ts b/packages/core/test/lib/integrations/consola.test.ts new file mode 100644 index 000000000000..66830fb75e06 --- /dev/null +++ b/packages/core/test/lib/integrations/consola.test.ts @@ -0,0 +1,303 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { getClient } from '../../../src/currentScopes'; +import { createConsolaReporter } from '../../../src/integrations/consola'; +import { _INTERNAL_captureLog } from '../../../src/logs/exports'; +import { formatConsoleArgs } from '../../../src/logs/utils'; +import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; + +// Mock dependencies +vi.mock('../../../src/logs/exports', () => ({ + _INTERNAL_captureLog: vi.fn(), +})); + +vi.mock('../../../src/logs/utils', async actual => ({ + formatConsoleArgs: vi.fn(((await actual()) as any).formatConsoleArgs), +})); + +vi.mock('../../../src/currentScopes', () => ({ + getClient: vi.fn(), +})); + +describe('createConsolaReporter', () => { + let mockClient: TestClient; + + beforeEach(() => { + vi.clearAllMocks(); + + // Create a test client with enableLogs: true + mockClient = new TestClient({ + ...getDefaultTestClientOptions({ dsn: 'https://username@domain/123' }), + enableLogs: true, + normalizeDepth: 3, + normalizeMaxBreadth: 1000, + }); + + vi.mocked(getClient).mockReturnValue(mockClient); + }); + + afterEach(() => { + vi.restoreAllMocks(); + }); + + describe('reporter creation', () => { + it('should create a reporter with log function', () => { + const reporter = createConsolaReporter(); + + expect(reporter).toEqual({ + log: expect.any(Function), + }); + }); + }); + + describe('log capturing', () => { + let sentryReporter: any; + + beforeEach(() => { + sentryReporter = createConsolaReporter(); + }); + + it('should capture error logs', () => { + const logObj = { + type: 'error', + level: 0, + message: 'This is an error', + tag: 'test', + date: new Date('2023-01-01T00:00:00.000Z'), + }; + + sentryReporter.log(logObj); + + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: 'error', + message: 'This is an error', + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.tag': 'test', + 'consola.type': 'error', + 'consola.level': 0, + }, + }); + }); + + it('should capture warn logs', () => { + const logObj = { + type: 'warn', + message: 'This is a warning', + }; + + sentryReporter.log(logObj); + + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: 'warn', + message: 'This is a warning', + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.type': 'warn', + }, + }); + }); + + it('should capture info logs', () => { + const logObj = { + type: 'info', + message: 'This is info', + }; + + sentryReporter.log(logObj); + + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: 'info', + message: 'This is info', + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.type': 'info', + }, + }); + }); + + it('should capture debug logs', () => { + const logObj = { + type: 'debug', + message: 'Debug message', + }; + + sentryReporter.log(logObj); + + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: 'debug', + message: 'Debug message', + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.type': 'debug', + }, + }); + }); + + it('should capture trace logs', () => { + const logObj = { + type: 'trace', + message: 'Trace message', + }; + + sentryReporter.log(logObj); + + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: 'trace', + message: 'Trace message', + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.type': 'trace', + }, + }); + }); + + it('should capture fatal logs', () => { + const logObj = { + type: 'fatal', + message: 'Fatal error', + }; + + sentryReporter.log(logObj); + + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: 'fatal', + message: 'Fatal error', + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.type': 'fatal', + }, + }); + }); + + it('should format message from args when message is not provided', () => { + const logObj = { + type: 'info', + args: ['Hello', 'world', 123, { key: 'value' }], + }; + + sentryReporter.log(logObj); + + expect(formatConsoleArgs).toHaveBeenCalledWith(['Hello', 'world', 123, { key: 'value' }], 3, 1000); + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: 'info', + message: 'Hello world 123 {"key":"value"}', + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.type': 'info', + }, + }); + }); + + it('should handle args with unparseable objects', () => { + const circular: any = {}; + circular.self = circular; + + const logObj = { + type: 'info', + args: ['Message', circular], + }; + + sentryReporter.log(logObj); + + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: 'info', + message: 'Message {"self":"[Circular ~]"}', + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.type': 'info', + }, + }); + }); + + it('should map consola levels to sentry levels when type is not provided', () => { + const logObj = { + level: 0, // Fatal level + message: 'Fatal message', + }; + + sentryReporter.log(logObj); + + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: 'fatal', + message: 'Fatal message', + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.level': 0, + }, + }); + }); + + it('should map various consola types correctly', () => { + const testCases = [ + { type: 'success', expectedLevel: 'info' }, + { type: 'fail', expectedLevel: 'error' }, + { type: 'ready', expectedLevel: 'info' }, + { type: 'start', expectedLevel: 'info' }, + { type: 'verbose', expectedLevel: 'debug' }, + { type: 'log', expectedLevel: 'info' }, + { type: 'silent', expectedLevel: 'trace' }, + ]; + + testCases.forEach(({ type, expectedLevel }) => { + vi.clearAllMocks(); + + sentryReporter.log({ + type, + message: `Test ${type} message`, + }); + + expect(_INTERNAL_captureLog).toHaveBeenCalledWith({ + level: expectedLevel, + message: `Test ${type} message`, + attributes: { + 'sentry.origin': 'auto.logging.consola', + 'consola.type': type, + }, + }); + }); + }); + }); + + describe('level filtering', () => { + it('should only capture specified levels', () => { + const filteredReporter = createConsolaReporter({ + levels: ['error', 'warn'], + }); + + // Should capture error + filteredReporter.log({ + type: 'error', + message: 'Error message', + }); + expect(_INTERNAL_captureLog).toHaveBeenCalledTimes(1); + + // Should capture warn + filteredReporter.log({ + type: 'warn', + message: 'Warn message', + }); + expect(_INTERNAL_captureLog).toHaveBeenCalledTimes(2); + + // Should not capture info + filteredReporter.log({ + type: 'info', + message: 'Info message', + }); + expect(_INTERNAL_captureLog).toHaveBeenCalledTimes(2); + }); + + it('should use default levels when none specified', () => { + const defaultReporter = createConsolaReporter(); + + // Should capture all default levels + ['trace', 'debug', 'info', 'warn', 'error', 'fatal'].forEach(type => { + defaultReporter.log({ + type, + message: `${type} message`, + }); + }); + + expect(_INTERNAL_captureLog).toHaveBeenCalledTimes(6); + }); + }); +}); diff --git a/packages/google-cloud-serverless/src/index.ts b/packages/google-cloud-serverless/src/index.ts index 26ed56f031d8..97207eb36c4f 100644 --- a/packages/google-cloud-serverless/src/index.ts +++ b/packages/google-cloud-serverless/src/index.ts @@ -125,6 +125,7 @@ export { vercelAIIntegration, logger, consoleLoggingIntegration, + createConsolaReporter, wrapMcpServerWithSentry, NODE_VERSION, featureFlagsIntegration, diff --git a/packages/node-core/src/index.ts b/packages/node-core/src/index.ts index cf581bd63b66..89da62015494 100644 --- a/packages/node-core/src/index.ts +++ b/packages/node-core/src/index.ts @@ -126,6 +126,7 @@ export { zodErrorsIntegration, profiler, consoleLoggingIntegration, + createConsolaReporter, consoleIntegration, wrapMcpServerWithSentry, featureFlagsIntegration, diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index da97071bdd32..d761013b045a 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -124,6 +124,7 @@ export { zodErrorsIntegration, profiler, consoleLoggingIntegration, + createConsolaReporter, consoleIntegration, wrapMcpServerWithSentry, featureFlagsIntegration, diff --git a/packages/remix/src/server/index.ts b/packages/remix/src/server/index.ts index 9a785f1d144c..ef25e4b703e6 100644 --- a/packages/remix/src/server/index.ts +++ b/packages/remix/src/server/index.ts @@ -118,6 +118,7 @@ export { zodErrorsIntegration, logger, consoleLoggingIntegration, + createConsolaReporter, createSentryWinstonTransport, } from '@sentry/node'; diff --git a/packages/solidstart/src/server/index.ts b/packages/solidstart/src/server/index.ts index 17e7eaa9ef50..d1ad987da56f 100644 --- a/packages/solidstart/src/server/index.ts +++ b/packages/solidstart/src/server/index.ts @@ -123,6 +123,7 @@ export { zodErrorsIntegration, logger, consoleLoggingIntegration, + createConsolaReporter, createSentryWinstonTransport, } from '@sentry/node'; diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index 56400dcc5423..3d41dd4e42b6 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -126,6 +126,7 @@ export { zodErrorsIntegration, logger, consoleLoggingIntegration, + createConsolaReporter, createSentryWinstonTransport, vercelAIIntegration, } from '@sentry/node'; diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index e2fd90eda5b7..c989ccc37cd6 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -92,6 +92,7 @@ export { spanToBaggageHeader, wrapMcpServerWithSentry, consoleLoggingIntegration, + createConsolaReporter, featureFlagsIntegration, } from '@sentry/core';