예제 #1
0
        static void Main()
        {
            SentryCore.Init("https://[email protected]/id"); // Initialize SDK

            try
            {
                App();
            }
            finally
            {
                SentryCore.CloseAndFlush();
            }
        }
예제 #2
0
        private static async Task Main(string[] args)
        {
            // With the SDK disabled so the callback is never invoked
            await SentryCore.ConfigureScopeAsync(async scope =>
            {
                // This could be any async I/O operation, like a DB query
                await Task.Yield();
                scope.SetExtra("Key", "Value");
            });

            // Enable the SDK
            SentryCore.Init(o =>
            {
                // Modifications to event before it goes out. Could replace the event altogether
                o.BeforeSend = @event =>
                {
                    // Drop an event altogether:
                    if (@event.Tags.ContainsKey("SomeTag"))
                    {
                        return(null);
                    }

                    // Create a totally new event or modify the current one:
                    @event.ServerName = null; // Make sure no ServerName is sent out
                    return(@event);
                };
            });

            await SentryCore.ConfigureScopeAsync(async scope =>
            {
                // This could be any async I/O operation, like a DB query
                await Task.Yield();
                scope.SetExtra("Key", "Value");
            });

            SentryCore.CaptureException(new Exception("Something went wrong."));

            SentryCore.CloseAndFlush();
        }
예제 #3
0
 public void CloseAndFlush_MultipleCalls_NoOp()
 {
     SentryCore.CloseAndFlush();
     SentryCore.CloseAndFlush();
     Assert.False(SentryCore.IsEnabled);
 }
예제 #4
0
 public void Dispose()
 {
     SentryCore.CloseAndFlush();
 }