Use LogSource Enum for logger and improve logging messages

This commit is contained in:
runebaas 2018-05-06 01:47:13 +02:00
parent 0fe273151c
commit 2b85caeb29
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
16 changed files with 122 additions and 95 deletions

View file

@ -46,7 +46,7 @@ namespace Geekbot.net.Commands.Admin
{
_redis.StringSet("Game", key);
await _client.SetGameAsync(key);
_logger.Information("Geekbot", $"Changed game to {key}");
_logger.Information(LogSource.Geekbot, $"Changed game to {key}");
await ReplyAsync($"Now Playing {key}");
}
@ -59,11 +59,11 @@ namespace Geekbot.net.Commands.Admin
var failed = 0;
try
{
_logger.Warning("UserRepository", "Populating User Repositry");
_logger.Warning(LogSource.UserRepository, "Populating User Repositry");
await ReplyAsync("Starting Population of User Repository");
foreach (var guild in _client.Guilds)
{
_logger.Information("UserRepository", $"Populating users from {guild.Name}");
_logger.Information(LogSource.UserRepository, $"Populating users from {guild.Name}");
foreach (var user in guild.Users)
{
var succeded = await _userRepository.Update(user);
@ -71,7 +71,7 @@ namespace Geekbot.net.Commands.Admin
}
}
_logger.Warning("UserRepository", "Finished Updating User Repositry");
_logger.Warning(LogSource.UserRepository, "Finished Updating User Repositry");
await ReplyAsync(
$"Successfully Populated User Repository with {success} Users in {_client.Guilds.Count} Guilds (Failed: {failed})");
}

View file

@ -102,7 +102,7 @@ namespace Geekbot.net.Commands.User.Ranking
}
catch (Exception e)
{
_logger.Warning("Geekbot", $"Could not retrieve user {user.Name}", e);
_logger.Warning(LogSource.Geekbot, $"Could not retrieve user {user.Name}", e);
}
}