Skip to content

Commit

Permalink
Replace all usage of Console.WriteLine with the logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Erisa committed Jul 5, 2024
1 parent e6d54e4 commit 96940d3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Commands/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task MuteDebug(CommandContext ctx, DiscordUser targetUser = default
}
else
{
Console.WriteLine(strOut);
Program.discord.Logger.LogError("Error ocurred uploading to Hastebin with status code: {code}\nPayload: {output}", hasteResult.StatusCode, strOut);
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Unknown error occurred during upload to Hastebin.\nPlease try again or contact the bot owner.");
}
}
Expand Down Expand Up @@ -106,7 +106,7 @@ public async Task BanDebug(CommandContext ctx, DiscordUser targetUser = default)
}
else
{
Console.WriteLine(strOut);
Program.discord.Logger.LogError("Error ocurred uploading to Hastebin with status code: {code}\nPayload: {output}", hasteResult.StatusCode, strOut);
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Unknown error occurred during upload to Hastebin.\nPlease try again or contact the bot owner.");
}
}
Expand Down Expand Up @@ -190,16 +190,16 @@ public async Task Shell(CommandContext ctx, [RemainingText] string command)

if (result.Length > 1947)
{
HasteBinResult hasteURL = await Program.hasteUploader.Post(result);
if (hasteURL.IsSuccess)
HasteBinResult hasteResult = await Program.hasteUploader.Post(result);
if (hasteResult.IsSuccess)
{
await msg.ModifyAsync($"Done, but output exceeded character limit! (`{result.Length}`/`1947`)\n" +
$"Full output can be viewed here: https://haste.erisa.uk/{hasteURL.Key}\nProcess exited with code `{finishedShell.proc.ExitCode}`.");
$"Full output can be viewed here: https://haste.erisa.uk/{hasteResult.Key}\nProcess exited with code `{finishedShell.proc.ExitCode}`.");
}
else
{
Console.WriteLine(finishedShell.result);
await msg.ModifyAsync($"Error occurred during upload to Hastebin.\nAction was executed regardless, shell exit code was `{finishedShell.proc.ExitCode}`. Hastebin status code is `{hasteURL.StatusCode}`.\nPlease check the console/log for the command output.");
Program.discord.Logger.LogError("Error ocurred uploading to Hastebin with status code: {code}\nPayload: {output}", hasteResult.StatusCode, finishedShell.result);
await msg.ModifyAsync($"Error occurred during upload to Hastebin.\nAction was executed regardless, shell exit code was `{finishedShell.proc.ExitCode}`. Hastebin status code is `{hasteResult.StatusCode}`.\nPlease check the console/log for the command output.");
}
}
else
Expand Down Expand Up @@ -296,7 +296,7 @@ public async Task CheckPendingChannelEvents(CommandContext ctx)
}
else
{
Console.WriteLine(list);
Program.discord.Logger.LogError("Error ocurred uploading to Hastebin with status code: {code}\nPayload: {output}", hasteResult.StatusCode, list);
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Unknown error occurred during upload to Hastebin.\nPlease try again or contact the bot owner.");
}
}
Expand Down

0 comments on commit 96940d3

Please sign in to comment.