Sentry.Extensions.Logging 0.0.1-preview4

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-preview4
dotnet add package Sentry.Extensions.Logging --version 0.0.1-preview4
<PackageReference Include="Sentry.Extensions.Logging" Version="0.0.1-preview4" />
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-preview4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Below you will find a basic introduction to the SDK and its API.

For more details, please: refer to the SDK documentation

Description

Integration of Microsoft.Extensions.Logging with Sentry

Main features

  • BeginScope data added to scope
  • LogInformation or higher added as breadcrumb. Sent with next events.
  • LogError or higher automatically captures an event
  • Strong named

By default, LogError or LogCritical by will send an event to Sentry. That can be configured to any level or disable altogether.

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)");
            }
        }
    }
}

Below you will find a basic introduction to the SDK and its API.

For more details, please: refer to the SDK documentation

Description

Integration of Microsoft.Extensions.Logging with Sentry

Main features

  • BeginScope data added to scope
  • LogInformation or higher added as breadcrumb. Sent with next events.
  • LogError or higher automatically captures an event
  • Strong named

By default, LogError or LogCritical by will send an event to Sentry. That can be configured to any level or disable altogether.

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

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Sentry.Extensions.Logging:

Package Downloads
Sentry.AspNetCore
Official ASP.NET Core integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.
BusManager
This client library for fork with bus data. Project is opensource. Repository https://github.com/KDEGitHub/BusManager
MariCommands.Sentry
MariCommands integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.
WCloud.Framework.Logging
Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.0.0-alpha.5 115 11/21/2020
3.0.0-alpha.4 225 11/2/2020
3.0.0-alpha.3 48 10/29/2020
3.0.0-alpha.2 91 10/21/2020
3.0.0-alpha.1 72 10/16/2020
3.0.0-alpha.0 318 9/25/2020
2.2.0-alpha 483 9/19/2020
2.1.8 2,778 11/21/2020
2.1.6 190,849 8/20/2020
2.1.5 79,711 7/27/2020
2.1.5-beta 1,360 6/30/2020
2.1.4 99,738 6/25/2020
2.1.3 164,377 6/5/2020
2.1.2-beta5 2,427 5/19/2020
2.1.2-beta4 738 5/12/2020
2.1.2-beta3 619 5/7/2020
2.1.2-beta2 3,385 4/16/2020
2.1.2-beta 1,770 3/31/2020
2.1.1 344,098 3/19/2020
2.1.0 148,686 2/24/2020
2.0.3 58,736 2/12/2020
2.0.2 17,045 2/8/2020
2.0.1 51,554 1/28/2020
2.0.0 602 1/28/2020
2.0.0-beta8 18,437 1/15/2020
2.0.0-beta7 67,799 12/17/2019
2.0.0-beta6 77,090 10/31/2019
2.0.0-beta5 4,464 10/29/2019
2.0.0-beta4 38,195 9/4/2019
2.0.0-beta3 14,239 7/26/2019
2.0.0-beta2 3,157 6/9/2019
2.0.0-beta 1,686 6/4/2019
1.2.1-beta 379 5/27/2019
1.2.0 886,625 5/23/2019
1.1.3-beta4 538 5/15/2019
1.1.3-beta3 310 5/13/2019
1.1.3-beta2 1,796 3/28/2019
1.1.3-beta 2,964 2/11/2019
1.1.2 295,141 1/16/2019
1.1.2-beta 1,537 1/8/2019
1.1.1 14,083 1/5/2019
1.1.0 36,293 12/5/2018
1.0.1-beta5 793 12/5/2018
1.0.1-beta4 1,391 12/3/2018
1.0.1-beta3 12,668 11/15/2018
1.0.1-beta2 1,263 11/14/2018
1.0.1-beta 14,663 10/24/2018
1.0.0 156,257 10/2/2018
1.0.0-rc2 19,440 9/7/2018
1.0.0-rc 3,863 8/24/2018
0.0.1-preview5 4,560 8/5/2018
0.0.1-preview4 3,170 7/30/2018
0.0.1-preview3 3,230 7/17/2018
0.0.1-preview2 4,099 7/3/2018
0.0.1-preview1 902 6/28/2018
Show less