Skip to content
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

misc(samples): Add console anything examples for replay testing #3928

Merged
merged 2 commits into from
Jul 3, 2024
Merged
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
7 changes: 7 additions & 0 deletions samples/expo/utils/setScopeProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,12 @@ export const setScopeProperties = () => {
category: 'TEST-CATEGORY',
});

console.log('This is a console log message.');
console.info('This is a console info message.');
console.warn('This is a console warn message.');
console.error('This is a console error message.');
console.debug('This is a console debug message.');
console.trace('This is a console trace message.');

console.log('Test scope properties were set.');
};
10 changes: 7 additions & 3 deletions samples/react-native/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { LogBox, Platform, StyleSheet, View } from 'react-native';
import { HttpClient } from '@sentry/integrations';
import Ionicons from 'react-native-vector-icons/Ionicons';
import PlaygroundScreen from './Screens/PlaygroundScreen';
import { logWithoutTracing } from './utils';

LogBox.ignoreAllLogs();

Expand All @@ -49,16 +50,19 @@ Sentry.init({
debug: true,
environment: 'dev',
beforeSend: (event: Sentry.Event) => {
console.log('Event beforeSend:', event.event_id);
logWithoutTracing('Event beforeSend:', event.event_id);
return event;
},
beforeSendTransaction(event) {
console.log('Transaction beforeSend:', event.event_id);
logWithoutTracing('Transaction beforeSend:', event.event_id);
return event;
},
// This will be called with a boolean `didCallNativeInit` when the native SDK has been contacted.
onReady: ({ didCallNativeInit }) => {
console.log('onReady called with didCallNativeInit:', didCallNativeInit);
logWithoutTracing(
'onReady called with didCallNativeInit:',
didCallNativeInit,
);
},
integrations(integrations) {
integrations.push(
Expand Down
2 changes: 0 additions & 2 deletions samples/react-native/src/Screens/TrackerScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ const TrackerScreen = () => {
(state === 'loaded' && 'Loaded') ||
'Unknown';
const shouldRecordFullDisplay = state === 'loaded' || state === 'error';
console.log('shouldRecordFullDisplay', shouldRecordFullDisplay);
console.log('statusText', statusText);

return (
<View style={styles.screen}>
Expand Down
7 changes: 7 additions & 0 deletions samples/react-native/src/setScopeProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,12 @@ export const setScopeProperties = () => {
category: 'TEST-CATEGORY',
});

console.log('This is a console log message.');
console.info('This is a console info message.');
console.warn('This is a console warn message.');
console.error('This is a console error message.');
console.debug('This is a console debug message.');
console.trace('This is a console trace message.');

console.log('Test scope properties were set.');
};
7 changes: 7 additions & 0 deletions samples/react-native/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function logWithoutTracing(...args: unknown[]) {
if ('__sentry_original__' in console.log) {
console.log.__sentry_original__(...args);
} else {
console.log(...args);
}
}
Loading