0
0
DJDavid Jozwik
This code captures three types of events: messages, exceptions, and events.
-
To capture a message, use the "message" method.
-
To capture an exception, use the "exception" method.
-
To capture an event with a deep customization, use the "event" method.
Library: next
import * as Sentry from '@sentry/nextjs';
Sentry.captureEvent({
message: "Event"
});
Sentry.captureException(new CustomException("CustomException"));
Sentry.captureException(new Error("Exception"));
Sentry.captureMessage("Minimalistic Message");
Sentry.captureMessage("Log Message", 'log');
Sentry.captureMessage("Kitchen Sink Message", {
tags: {
grade: "5"
},
contexts: {
context1: {
contextual: "context"
}
},
extra: {
battery: 0.4
},
level: "fatal",
user: {
id: 'helloworld123abc',
email: "jimbob@nonexistent-4353456.com"
},
fingerprint: [
Date.now().toString()
],
requestSession: {
status: "ok"
}
});