Log result failures with stack traces (#282)

This feature will improve the debugging experience for developers by
providing the information about *where exactly* a result has failed

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2024-03-20 23:08:16 +05:00 committed by GitHub
parent 5cc04e9cc3
commit 309d900067
Signed by: GitHub
GPG key ID: B5690EEEBB952194
21 changed files with 145 additions and 71 deletions

View file

@ -2,6 +2,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Octobot.Attributes;
using Octobot.Commands.Events;
using Octobot.Services;
using Octobot.Services.Update;
@ -25,10 +26,14 @@ public sealed class Octobot
public static readonly AllowedMentions NoMentions = new(
Array.Empty<MentionType>(), Array.Empty<Snowflake>(), Array.Empty<Snowflake>());
[StaticCallersOnly]
public static ILogger<Octobot>? StaticLogger { get; private set; }
public static async Task Main(string[] args)
{
var host = CreateHostBuilder(args).UseConsoleLifetime().Build();
var services = host.Services;
StaticLogger = services.GetRequiredService<ILogger<Octobot>>();
var slashService = services.GetRequiredService<SlashService>();
// Providing a guild ID to this call will result in command duplicates!