Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Logging for TournamentCreator #172

Merged
merged 2 commits into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions TournamentManager/TournamentManager/TournamentCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public async Task SetTournamentCompleted(long tournamentId, CancellationToken ca
if (!await _appDb.MatchRepository.AllMatchesCompletedAsync(new TournamentEntity(tournamentId), cancellationToken))
{
var ex = new InvalidOperationException($@"Tournament {tournamentId} contains incomplete matches.");
_logger.LogCritical(ex.Message, ex);
_logger.LogCritical(@"Tournament {TournamentId} contains incomplete matches. {Exception}", tournamentId, ex);
throw ex;
}

Expand All @@ -253,18 +253,18 @@ public async Task SetTournamentCompleted(long tournamentId, CancellationToken ca
if (!await da.SaveEntityAsync(tournament, true, true, cancellationToken))
{
var ex = new InvalidOperationException($"Tournament Id {tournamentId} could not be saved to persistent storage.");
_logger.LogCritical(ex.Message, ex);
_logger.LogCritical(@"Tournament Id {TournamentId} could not be saved to persistent storage. {Exception}", tournamentId, ex);
throw ex;
}
_logger.LogInformation("Tournament {tournament} set as completed.", tournament);
_logger.LogInformation("Tournament {Tournament} set as completed.", tournament);
}

public virtual async Task SetRoundCompleted(RoundEntity round, CancellationToken cancellationToken)
{
if (!await _appDb.MatchRepository.AllMatchesCompletedAsync(round, cancellationToken))
{
var ex = new InvalidOperationException($"Round {round.Id} has uncompleted matches.");
_logger.LogCritical(ex.Message, ex);
_logger.LogCritical(@"Round {RoundId} has uncompleted matches. {Exception}", round.Id, ex);
throw ex;
}

Expand Down