Add More logging Statements
This commit is contained in:
parent
79e52774b8
commit
2a12d30d8f
6 changed files with 106 additions and 34 deletions
|
@ -19,7 +19,7 @@ namespace Geekbot.net.Lib
|
|||
checkEmImageArray = rawCheckEmPics.Split("\n");
|
||||
totalCheckEmImages = checkEmImageArray.Length;
|
||||
this.rnd = rnd;
|
||||
logger.Information($"-- Loaded {totalCheckEmImages} CheckEm Images");
|
||||
logger.Information($"[Geekbot] [CheckEm] Loaded {totalCheckEmImages} CheckEm Images");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
32
Geekbot.net/Lib/ErrorHandler.cs
Normal file
32
Geekbot.net/Lib/ErrorHandler.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using Discord.Commands;
|
||||
using Serilog;
|
||||
|
||||
namespace Geekbot.net.Lib
|
||||
{
|
||||
public class ErrorHandler : IErrorHandler
|
||||
{
|
||||
private readonly ILogger logger;
|
||||
// private readonly IDMChannel botOwnerDmChannel;
|
||||
|
||||
public ErrorHandler(ILogger logger /*, IDMChannel botOwnerDmChannel*/)
|
||||
{
|
||||
this.logger = logger;
|
||||
// this.botOwnerDmChannel = botOwnerDmChannel;
|
||||
}
|
||||
|
||||
public async void HandleCommandException(Exception e, ICommandContext Context)
|
||||
{
|
||||
var errorMsg =
|
||||
$"Error Occured while executing \"{Context.Message.Content}\", executed by \"{Context.User.Username}\"";
|
||||
logger.Error(e, errorMsg);
|
||||
// await botOwnerDmChannel.SendMessageAsync($"{errorMsg}```{e.StackTrace}```");
|
||||
// await Context.Channel.SendMessageAsync("Something went wrong...");
|
||||
}
|
||||
}
|
||||
|
||||
public interface IErrorHandler
|
||||
{
|
||||
void HandleCommandException(Exception e, ICommandContext Context);
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ namespace Geekbot.net.Lib
|
|||
fortuneArray = rawFortunes.Split("%");
|
||||
totalFortunes = fortuneArray.Length;
|
||||
this.rnd = rnd;
|
||||
logger.Information($"-- Loaded {totalFortunes} Fortunes");
|
||||
logger.Information($"[Geekbot] [Fortunes] Loaded {totalFortunes} Fortunes");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Geekbot.net.Lib
|
|||
PandaArray = rawFortunes.Split("\n");
|
||||
totalPandas = PandaArray.Length;
|
||||
this.rnd = rnd;
|
||||
logger.Information($"-- Loaded {totalPandas} Panda Images");
|
||||
logger.Information($"[Geekbot] [Pandas] Loaded {totalPandas} Panda Images");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue