|
|
@@ -1,5 +1,4 @@
|
|
|
import * as Sentry from "@sentry/react";
|
|
|
-import Cohere from "cohere-js";
|
|
|
import { isEmpty } from "lodash";
|
|
|
|
|
|
type LogFunction = (error: Error, tags?: { [key: string]: string }) => void;
|
|
|
@@ -16,32 +15,16 @@ const logFunctionBuilder: LogFunctionBuilder = (scope, severity) => (
|
|
|
error,
|
|
|
tags
|
|
|
) => {
|
|
|
- if (process.env.ENABLE_COHERE) {
|
|
|
- Cohere.getSessionUrl((sessionUrl) => {
|
|
|
- Sentry.withScope((sentryScope) => {
|
|
|
- sentryScope.setTag("scope", scope);
|
|
|
- sentryScope.setTag("cohere_link", sessionUrl);
|
|
|
- sentryScope.setLevel(severity);
|
|
|
+ Sentry.withScope((sentryScope) => {
|
|
|
+ sentryScope.setTag("scope", scope);
|
|
|
+ sentryScope.setLevel(severity);
|
|
|
|
|
|
- if (!isEmpty(tags)) {
|
|
|
- sentryScope.setTags(tags);
|
|
|
- }
|
|
|
+ if (!isEmpty(tags)) {
|
|
|
+ sentryScope.setTags(tags);
|
|
|
+ }
|
|
|
|
|
|
- Sentry.captureException(error);
|
|
|
- });
|
|
|
- });
|
|
|
- } else {
|
|
|
- Sentry.withScope((sentryScope) => {
|
|
|
- sentryScope.setTag("scope", scope);
|
|
|
- sentryScope.setLevel(severity);
|
|
|
-
|
|
|
- if (!isEmpty(tags)) {
|
|
|
- sentryScope.setTags(tags);
|
|
|
- }
|
|
|
-
|
|
|
- Sentry.captureException(error);
|
|
|
- });
|
|
|
- }
|
|
|
+ Sentry.captureException(error);
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
function buildLogger(scope: string = "global") {
|