Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(core): Add Consola integration #17435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AbhiPrasad wants to merge 2 commits into develop
base: develop
Choose a base branch
Loading
from abhi-consola-integration
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
View file Open in desktop
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
View file Open in desktop
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://public@dsn.ingest.sentry.io/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();
View file Open in desktop
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://public@dsn.ingest.sentry.io/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();
View file Open in desktop
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://public@dsn.ingest.sentry.io/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
View file Open in desktop
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://public@dsn.ingest.sentry.io/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();
View file Open in desktop
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://public@dsn.ingest.sentry.io/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
View file Open in desktop
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://public@dsn.ingest.sentry.io/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

AltStyle によって変換されたページ (->オリジナル) /