mowispace / react-native-logs

Performance-aware simple logger for React-Native and Expo with namespaces, custom levels and custom transports (colored console, file writing, etc.)
MIT License
467 stars 33 forks source link

Sentrytransport Error #45

Closed bcteam2020 closed 3 years ago

bcteam2020 commented 3 years ago

Sentrytransport causing the below error Error TaskQueue: Error with task : t.options.SENTRY.captureException is not a function. (In 't.options.SENTRY.captureException(t.msg)', 't.options.SENTRY.captureException' is undefined)

App is getting crashed on open and above error is seen in Sentry.

Configuration Expo managed workflow SDK 40 sentry expo package 4.0.1 react native loggers Config const config = { severity: DEV ? "debug":"error", transport: DEV ? consoleTransport : sentryTransport, transportOptions: { colors: "ansi", // custom option that color consoleTransport logs, SENTRY: Sentry }, levels: { debug: 0, info: 1, warn: 2, error: 3, }, async: true, dateFormat: "time", printLevel: true, printDate: true, enabled: true, };

alessandro-bottamedi commented 3 years ago

Sentry expo package seems to work a little differently, you can try this config:

import * as Sentry from 'sentry-expo';

const config = {
  ...
  transportOptions: {
    SENTRY: Sentry.Native,
  },
};

var log = logger.createLogger(config);

log.error("Send this log to Sentry");
bcteam2020 commented 3 years ago

Thanks, This is working