diff --git a/CHANGELOG.md b/CHANGELOG.md index f9ba6a37c..9d3076331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix playback of interlaced mpeg2video content with NVIDIA acceleration - Fix playback of all interlaced content with QSV acceleration +### Added +- Add automated error reporting via Bugsnag + - This can be disabled by editing the `appsettings.json` file or by setting the `Bugsnag:Enable` environment variable to `false` + ### Changed - Framerate normalization will never normalize framerate below 24fps - Instead, content with a lower framerate will be normalized up to 24fps diff --git a/ErsatzTV.Core/Errors/BugsnagConfiguration.cs b/ErsatzTV.Core/Errors/BugsnagConfiguration.cs new file mode 100644 index 000000000..b5cd9d2ca --- /dev/null +++ b/ErsatzTV.Core/Errors/BugsnagConfiguration.cs @@ -0,0 +1,7 @@ +namespace ErsatzTV.Core.Errors; + +public class BugsnagConfiguration +{ + public string ApiKey { get; set; } + public bool Enable { get; set; } +} diff --git a/ErsatzTV/ErsatzTV.csproj b/ErsatzTV/ErsatzTV.csproj index 90782d48d..faaecb7e2 100644 --- a/ErsatzTV/ErsatzTV.csproj +++ b/ErsatzTV/ErsatzTV.csproj @@ -12,6 +12,7 @@ + diff --git a/ErsatzTV/Startup.cs b/ErsatzTV/Startup.cs index 344acd67d..c5b422b4f 100644 --- a/ErsatzTV/Startup.cs +++ b/ErsatzTV/Startup.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Text; using System.Threading.Channels; using Blazored.LocalStorage; +using Bugsnag.AspNet.Core; using Dapper; using ErsatzTV.Application; using ErsatzTV.Application.Channels.Queries; @@ -12,6 +13,7 @@ using ErsatzTV.Application.Streaming; using ErsatzTV.Application.Streaming.Commands; using ErsatzTV.Core; using ErsatzTV.Core.Emby; +using ErsatzTV.Core.Errors; using ErsatzTV.Core.FFmpeg; using ErsatzTV.Core.Health; using ErsatzTV.Core.Health.Checks; @@ -80,6 +82,23 @@ namespace ErsatzTV public void ConfigureServices(IServiceCollection services) { + BugsnagConfiguration bugsnagConfig = Configuration.GetSection("Bugsnag").Get(); + + services.AddBugsnag( + configuration => + { + configuration.ApiKey = bugsnagConfig.ApiKey; + configuration.ProjectNamespaces = new[] { "ErsatzTV" }; + configuration.AppVersion = Assembly.GetEntryAssembly() + ?.GetCustomAttribute() + ?.InformationalVersion ?? "unknown"; + + configuration.NotifyReleaseStages = new[] { "public" }; + + // effectively "disable" by tweaking app config + configuration.ReleaseStage = bugsnagConfig.Enable ? "public" : "private"; + }); + services.AddCors( o => o.AddPolicy( "AllowAll", diff --git a/ErsatzTV/appsettings.json b/ErsatzTV/appsettings.json index 95544739b..b5f767a6d 100644 --- a/ErsatzTV/appsettings.json +++ b/ErsatzTV/appsettings.json @@ -34,5 +34,9 @@ }, "Trakt": { "ClientId": "5a4e78338b7f177cf980d6a8881dd5a52dee680746864e9e442b42d5f4d4ac82" + }, + "Bugsnag": { + "ApiKey": "f59f3cc93cce91210a5c0f047eb2047c", + "Enable": true } } \ No newline at end of file