Add More logging Statements

This commit is contained in:
Runebaas 2017-09-26 22:09:57 +02:00
parent 79e52774b8
commit 2a12d30d8f
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
6 changed files with 106 additions and 34 deletions

View file

@ -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
{

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

View file

@ -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
{

View file

@ -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
{