Sentry.Extensions.Logging 0.0.1-preview1

Official Microsoft.Extensions.Logging integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.

This is a prerelease version of Sentry.Extensions.Logging.
There is a newer version of this package available.
See the version list below for details.
Install-Package Sentry.Extensions.Logging -Version 0.0.1-preview1
dotnet add package Sentry.Extensions.Logging --version 0.0.1-preview1
<PackageReference Include="Sentry.Extensions.Logging" Version="0.0.1-preview1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sentry.Extensions.Logging --version 0.0.1-preview1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Integration of Microsoft.Extensions.Logging with Sentry

By default, LogError or LogCritical by will send an event to Sentry.

Log messages of level Information or higher will be kept as breadcrumbs and if an event is sent, all breadcrumbs from that transaction are included.

These levels can be configured so that the level you define, tracks breadcrumbs, sends events or completely disable it.

That means that log mesages logged by you or the framework, related to the failed transaction, will be added to the event!

Sample:


 using (var loggerFactory = new LoggerFactory()
            .AddConsole(LogLevel.Trace)
            .AddSentry(o =>
            {
                // Initialize the SDK, alternative to relying on previously called: `using(SentrySdk.Init)`:
                // this is useful when Logging is the first or is the only integration enabled:
                o.Init(i =>
                {
                    i.Dsn = new Dsn("https://5fd7a6cda8444965bade9ccfd3df9882@sentry.io/1188141");
                    i.MaxBreadcrumbs = 150; // Increasing from default 100
                });

                // Optionally configure options: The default values are:
                o.MinimumBreadcrumbLevel = LogLevel.Information; // It requires at least this level to store breadcrumb
                o.MinimumEventLevel = LogLevel.Error; // This level or above will result in event sent to Sentry
            }))
        {
            var logger = loggerFactory.CreateLogger<Program>();

            logger.LogTrace("1 - By *default* this log level is ignored by Sentry.");

            logger.LogInformation("2 - Information messages are stored as Breadcrumb, sent with the next event.");

            logger.LogError("3 - This generates an event, captured by sentry and includes breadcrumbs (2) tracked in this transaction.");

            using (logger.BeginScope(new Dictionary<string, string>
                {
                    {"A", "some value"},
                    {"B", "more value"},
                }))
            {
                logger.LogWarning("4 - Breadcrumb that only exists inside this scope");

                logger.LogError("5 - An event that includes the scoped key-value (A, B) above and also the breadcrumbs: (2, 4) and event (3)");
            }
        }
    }
}

Integration of Microsoft.Extensions.Logging with Sentry

By default, LogError or LogCritical by will send an event to Sentry.

Log messages of level Information or higher will be kept as breadcrumbs and if an event is sent, all breadcrumbs from that transaction are included.

These levels can be configured so that the level you define, tracks breadcrumbs, sends events or completely disable it.

That means that log mesages logged by you or the framework, related to the failed transaction, will be added to the event!

Sample:


 using (var loggerFactory = new LoggerFactory()
            .AddConsole(LogLevel.Trace)
            .AddSentry(o =>
            {
                // Initialize the SDK, alternative to relying on previously called: `using(SentrySdk.Init)`:
                // this is useful when Logging is the first or is the only integration enabled:
                o.Init(i =>
                {
                    i.Dsn = new Dsn("https://5fd7a6cda8444965bade9ccfd3df9882@sentry.io/1188141");
                    i.MaxBreadcrumbs = 150; // Increasing from default 100
                });

                // Optionally configure options: The default values are:
                o.MinimumBreadcrumbLevel = LogLevel.Information; // It requires at least this level to store breadcrumb
                o.MinimumEventLevel = LogLevel.Error; // This level or above will result in event sent to Sentry
            }))
        {
            var logger = loggerFactory.CreateLogger<Program>();

            logger.LogTrace("1 - By *default* this log level is ignored by Sentry.");

            logger.LogInformation("2 - Information messages are stored as Breadcrumb, sent with the next event.");

            logger.LogError("3 - This generates an event, captured by sentry and includes breadcrumbs (2) tracked in this transaction.");

            using (logger.BeginScope(new Dictionary<string, string>
                {
                    {"A", "some value"},
                    {"B", "more value"},
                }))
            {
                logger.LogWarning("4 - Breadcrumb that only exists inside this scope");

                logger.LogError("5 - An event that includes the scoped key-value (A, B) above and also the breadcrumbs: (2, 4) and event (3)");
            }
        }
    }
}

Release Notes

Can be found at: https://github.com/getsentry/sentry-dotnet/releases

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.0-beta6 2,999 10/31/2019
2.0.0-beta5 585 10/29/2019
2.0.0-beta4 11,819 9/4/2019
2.0.0-beta3 3,884 7/26/2019
2.0.0-beta2 2,114 6/9/2019
2.0.0-beta 1,332 6/4/2019
1.2.1-beta 234 5/27/2019
1.2.0 259,109 5/23/2019
1.1.3-beta4 327 5/15/2019
1.1.3-beta3 135 5/13/2019
1.1.3-beta2 1,511 3/28/2019
1.1.3-beta 2,443 2/11/2019
1.1.2 220,316 1/16/2019
1.1.2-beta 1,184 1/8/2019
1.1.1 9,832 1/5/2019
1.1.0 23,995 12/5/2018
1.0.1-beta5 619 12/5/2018
1.0.1-beta4 1,170 12/3/2018
1.0.1-beta3 9,307 11/15/2018
1.0.1-beta2 853 11/14/2018
1.0.1-beta 11,683 10/24/2018
1.0.0 116,794 10/2/2018
1.0.0-rc2 13,952 9/7/2018
1.0.0-rc 3,582 8/24/2018
0.0.1-preview5 4,009 8/5/2018
0.0.1-preview4 2,908 7/30/2018
0.0.1-preview3 2,667 7/17/2018
0.0.1-preview2 3,759 7/3/2018
0.0.1-preview1 675 6/28/2018
Show less