From 0be19886bdda8a7729e01faa8e5c49eb8e5d601f Mon Sep 17 00:00:00 2001 From: Albie Spriddell Date: Mon, 16 Oct 2023 13:32:08 +0100 Subject: [PATCH 1/2] add sentry logging support --- .../DragonFruit.OnionFruit.Web.Worker.csproj | 1 + DragonFruit.OnionFruit.Web.Worker/Program.cs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/DragonFruit.OnionFruit.Web.Worker/DragonFruit.OnionFruit.Web.Worker.csproj b/DragonFruit.OnionFruit.Web.Worker/DragonFruit.OnionFruit.Web.Worker.csproj index 29cdd75..9b534e2 100644 --- a/DragonFruit.OnionFruit.Web.Worker/DragonFruit.OnionFruit.Web.Worker.csproj +++ b/DragonFruit.OnionFruit.Web.Worker/DragonFruit.OnionFruit.Web.Worker.csproj @@ -20,6 +20,7 @@ + diff --git a/DragonFruit.OnionFruit.Web.Worker/Program.cs b/DragonFruit.OnionFruit.Web.Worker/Program.cs index 3f0fd45..fb30c80 100644 --- a/DragonFruit.OnionFruit.Web.Worker/Program.cs +++ b/DragonFruit.OnionFruit.Web.Worker/Program.cs @@ -62,6 +62,16 @@ private static void ConfigureLogging(HostBuilderContext host, ILoggingBuilder lo o.SourceName = $"OnionFruit-Web-Worker/v{Assembly.GetExecutingAssembly().GetName().Version.ToString(3)}"; }); #endif + + logging.AddSentry(o => + { + o.Dsn = host.Configuration["Worker:Dsn"] ?? host.Configuration["Dsn"]; + o.Release = Assembly.GetExecutingAssembly().GetName().Version!.ToString(3); + + o.MaxBreadcrumbs = 50; + o.MinimumEventLevel = LogLevel.Error; + o.MinimumBreadcrumbLevel = LogLevel.Debug; + }); } private static void ConfigureServices(HostBuilderContext context, IServiceCollection services) From d65c34b271a73fc2c469f39cbaa9e450d309a6a9 Mon Sep 17 00:00:00 2001 From: Albie Spriddell Date: Mon, 16 Oct 2023 13:39:57 +0100 Subject: [PATCH 2/2] add simple console support --- DragonFruit.OnionFruit.Web.Worker/Program.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/DragonFruit.OnionFruit.Web.Worker/Program.cs b/DragonFruit.OnionFruit.Web.Worker/Program.cs index fb30c80..acf74be 100644 --- a/DragonFruit.OnionFruit.Web.Worker/Program.cs +++ b/DragonFruit.OnionFruit.Web.Worker/Program.cs @@ -55,6 +55,14 @@ private static void ConfigureHost(IConfigurationBuilder host) private static void ConfigureLogging(HostBuilderContext host, ILoggingBuilder logging) { + logging.ClearProviders(); + logging.AddSimpleConsole(o => + { + o.SingleLine = true; + o.IncludeScopes = false; + o.TimestampFormat = "[dd/MM/yyyy hh:mm:ss] "; + }); + #if WINDOWS logging.AddEventLog(o => {