Skip to content

Feature: Add Flush/Close SentrySdk method #52

@lunim

Description

@lunim

For situations where the SentrySdk is not in a using block, it would be nice to have a way to formally close/flush pending methods and possibly await. For example, this code in a console app will often result in no or missing messages:

public static async Task<int> Main(string[] args)
{
    SentrySdk.Init(s =>
    {
        s.Dsn = new Dsn("<url>");
    });

    SentrySdk.CaptureMessage("Message 1");
}

The primary reason for not simply having a using block involves multiple libraries/modules in my code.

Adding a function such as "SentrySdk.Flush();" or "await SentrySdk.FlushAsync(CancellationToken);" to ensure all messages have been sent would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions