public Task Log(LogMessage discordLogMessage) { var message = _messageFactory.CreateLogMessage(discordLogMessage); switch (discordLogMessage.Severity) { case LogSeverity.Critical: _logger.LogCritical(message.Display()); break; case LogSeverity.Error: _logger.LogError(message.Display()); break; case LogSeverity.Warning: _logger.LogWarning(message.Display()); break; case LogSeverity.Info: _logger.LogInformation(message.Display()); break; case LogSeverity.Verbose: case LogSeverity.Debug: _logger.LogDebug(message.Display()); break; default: _logger.LogDebug(message.Display()); break; } return(Task.CompletedTask); }
public async Task StartAsync(CancellationToken cancellationToken) { var message = _messageFactory.CreateLogMessage("Starting..."); _logger.LogInformation(message.Display()); try { await _client.LoginAsync(TokenType.Bot, _config.Discord.BotToken); await _client.StartAsync(); await _client.SetGameAsync("with code | *help"); } catch (Exception ex) { var critical = _messageFactory.CreateLogMessage(ex); _logger.LogCritical(critical.Display()); } }