Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dev-packages/node-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
31 changes: 31 additions & 0 deletions dev-packages/node-integration-tests/suites/consola/subject-args.ts
Original file line number Diff line number Diff line change
@@ -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://[email protected]/1337',
release: '1.0.0',
environment: 'test',
enableLogs: true,
transport: loggingTransport,
});

async function run(): Promise<void> {
// 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();
Original file line number Diff line number Diff line change
@@ -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://[email protected]/1337',
release: '1.0.0',
environment: 'test',
enableLogs: true,
transport: loggingTransport,
});

async function run(): Promise<void> {
// 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();
Original file line number Diff line number Diff line change
@@ -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://[email protected]/1337',
release: '1.0.0',
environment: 'test',
enableLogs: true,
transport: loggingTransport,
});

async function run(): Promise<void> {
// 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();
32 changes: 32 additions & 0 deletions dev-packages/node-integration-tests/suites/consola/subject-tags.ts
Original file line number Diff line number Diff line change
@@ -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://[email protected]/1337',
release: '1.0.0',
environment: 'test',
enableLogs: true,
transport: loggingTransport,
});

async function run(): Promise<void> {
// 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();
Original file line number Diff line number Diff line change
@@ -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://[email protected]/1337',
release: '1.0.0',
environment: 'test',
enableLogs: true,
transport: loggingTransport,
});

async function run(): Promise<void> {
// 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();
32 changes: 32 additions & 0 deletions dev-packages/node-integration-tests/suites/consola/subject.ts
Original file line number Diff line number Diff line change
@@ -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://[email protected]/1337',
release: '1.0.0',
environment: 'test',
enableLogs: true,
transport: loggingTransport,
});

async function run(): Promise<void> {
// 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();
Loading
Loading