Skip to content

Changing attachments after sentry_initΒ #586

@thanhldnv

Description

@thanhldnv

Description
I'm reading the source of Sentry SDK, and I see a comment relate using sentry_options_t *options.

/**
 * Initializes the Sentry SDK with the specified options.
 *
 * This takes ownership of the options.  After the options have been set
 * they cannot be modified any more.
 * Depending on the configured transport and backend, this function might not be
 * fully thread-safe.
 * Returns 0 on success.
 */
SENTRY_API int sentry_init(sentry_options_t *options);

My application need to attach the log file when a crash occurs. My logger works like unix logrotate, it will generate a new file every day or when the file size exceeds a limit. Then I need to update the new log file path via sentry_options_add_attachment so I understand this function will change the options object.
So can I use sentry_options_add_attachment after sentry_init and is it safe ?
As I tested this way Sentry still work well.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Needs Discussion

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions