Exemplo n.º 1
0
 public void AddBreadcrumb(
     string message,
     string type,
     string category = null,
     IDictionary <string, string> data = null,
     BreadcrumbLevel level             = default)
 => SentryCore.AddBreadcrumb(message, type, category, data, level);
Exemplo n.º 2
0
        public void Init_MultipleCalls_ReplacesHubWithLatest()
        {
            var first = SentryCore.Init(ValidDsnWithSecret);

            SentryCore.AddBreadcrumb("test", "type");
            var called = false;

            SentryCore.ConfigureScope(p =>
            {
                called = true;
                Assert.Single(p.Breadcrumbs);
            });
            Assert.True(called);
            called = false;

            var second = SentryCore.Init(ValidDsnWithSecret);

            SentryCore.ConfigureScope(p =>
            {
                called = true;
                Assert.Empty(p.Breadcrumbs);
            });
            Assert.True(called);

            first.Dispose();
            second.Dispose();
        }
Exemplo n.º 3
0
 public void EnabledClient_AddBreadcrumb()
 {
     for (int i = 0; i < BreadcrumbsCount; i++)
     {
         SentryCore.AddBreadcrumb(
             Message,
             Type,
             Category,
             Data,
             Level);
     }
 }
Exemplo n.º 4
0
 public void AddBreadcrumb(
     ISystemClock clock,
     string message,
     string type     = null,
     string category = null,
     IDictionary <string, string> data = null,
     BreadcrumbLevel level             = default)
 => SentryCore.AddBreadcrumb(
     clock: clock,
     message: message,
     type: type,
     data: data,
     category: category,
     level: level);
Exemplo n.º 5
0
 public void EnabledSdk_PushScope_AddBreadcrumb_PopScope()
 {
     using (SentryCore.PushScope())
     {
         for (int i = 0; i < BreadcrumbsCount; i++)
         {
             SentryCore.AddBreadcrumb(
                 Message,
                 Type,
                 Category,
                 Data,
                 Level);
         }
     }
 }
Exemplo n.º 6
0
        public void Dispose_DisposingFirst_DoesntAffectSecond()
        {
            var first  = SentryCore.Init(ValidDsnWithSecret);
            var second = SentryCore.Init(ValidDsnWithSecret);

            SentryCore.AddBreadcrumb("test", "type");
            first.Dispose();
            var called = false;

            SentryCore.ConfigureScope(p =>
            {
                called = true;
                Assert.Single(p.Breadcrumbs);
            });
            Assert.True(called);
            second.Dispose();
        }
Exemplo n.º 7
0
            public void Invoke(dynamic request)
            {
                using (SentryCore.PushScope())
                {
                    SentryCore.AddBreadcrumb(request.Path, "request-path");

                    // Change the SentryClient in case the request is to the admin part:
                    if (request.Path.StartsWith("/admin"))
                    {
                        // Within this scope, the _adminClient will be used instead of whatever
                        // client was defined before this point:
                        SentryCore.BindClient(_adminClient);
                    }

                    SentryCore.CaptureException(new Exception("Error at the admin section"));
                    // Else it uses the default client

                    _middleware?.Invoke(request);
                } // Scope is disposed.
            }
Exemplo n.º 8
0
 public void AddBreadcrumb_WithClock_NoOp() => SentryCore.AddBreadcrumb(clock: null, null, null);
Exemplo n.º 9
0
 public void AddBreadcrumb_NoClock_NoOp() => SentryCore.AddBreadcrumb(message: null, type: null);