Skip to content

test: Add browser integration tests for logs #15815

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

Merged
merged 11 commits into from
Mar 26, 2025
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as Sentry from '@sentry/browser';

window.Sentry = Sentry;

Sentry.init({
dsn: 'https://[email protected]/1337',
_experiments: {
enableLogs: true,
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Sentry.logger.trace('test trace');
Sentry.logger.debug('test debug');
Sentry.logger.info('test info');
Sentry.logger.warn('test warn');
Sentry.logger.error('test error');
Sentry.logger.fatal('test fatal');

const formattedMessage = (message, stringArg, boolArg, numberArg) => {
return Sentry.logger.fmt`test ${message} ${stringArg} ${boolArg} ${numberArg}`;
};

Sentry.logger.trace(formattedMessage('trace', 'stringArg', false, 123));
Sentry.logger.debug(formattedMessage('debug', 'stringArg', false, 123));
Sentry.logger.info(formattedMessage('info', 'stringArg', false, 123));
Sentry.logger.warn(formattedMessage('warn', 'stringArg', false, 123));
Sentry.logger.error(formattedMessage('error', 'stringArg', false, 123));
Sentry.logger.fatal(formattedMessage('fatal', 'stringArg', false, 123));

Sentry.flush();
Loading
Loading