Skip to content

feat(logs): Add support for logs#920

Merged
lucas-zimerman merged 2 commits intomainfrom
lz/feat/logs
Jun 17, 2025
Merged

feat(logs): Add support for logs#920
lucas-zimerman merged 2 commits intomainfrom
lz/feat/logs

Conversation

@lucas-zimerman
Copy link
Collaborator

This PR enables the support for logs on Sentry Capacitor.
Additionally, it also exposes the logger integration into capacitor to simplify the documentation of it.

How to enable:

To enable it, add the following code to your Sentry Options:

Sentry.init({
  // other options...
  _experiments: {
    enableLogs: true,
  },
});

You can also filter the logs being collected by adding beforeSendLogs into _experiments

Sentry.init({
  // other options...
  _experiments: {
    enableLogs: true,
    beforeSendLog: log => {
      return log;
    },
  },
});

How to use

simply import logger from @sentry/capacitor and capture a log with it, example:

import { logger } from '@sentry/capacitor';

    logger.info('hello world capacitor');
    logger.warn('hello world capacitor');
    logger.error('hello world capacitor');
    logger.fatal('hello world capacitor', {
      customAttribute: 1234,
      complexAttribute: { logged: true}
    });

@lucas-zimerman lucas-zimerman requested a review from antonis June 16, 2025 15:05
@lucas-zimerman lucas-zimerman marked this pull request as ready for review June 16, 2025 15:15
Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes LGTM, aligned with RN and worked as expected 🚀

ps. I'm not sure why the Dependency Review check fails but I don't see any related changes on this PR 🤔

@lucas-zimerman
Copy link
Collaborator Author

The changes LGTM, aligned with RN and worked as expected 🚀

ps. I'm not sure why the Dependency Review check fails but I don't see any related changes on this PR 🤔

I think it's a new CI check that was added recently to the project but it seems like the repo doesn't support it
"Dependency review is not supported on this repository. Please ensure that Dependency graph is enabled along with GitHub Advanced Security on private repositories"

@lucas-zimerman lucas-zimerman merged commit 95537a8 into main Jun 17, 2025
15 of 17 checks passed
@lucas-zimerman lucas-zimerman deleted the lz/feat/logs branch June 17, 2025 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants