Skip to content

Commit

Permalink
Add missing logging for get all games
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEadie committed Aug 1, 2023
1 parent 476b99a commit 3fdca0a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/hub/src/Worms.Gateway/Controllers/GamesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ public GamesController(
}

[HttpGet]
public ActionResult<IReadOnlyCollection<GameDto>> Get() => _repository.Get().ToList();
public ActionResult<IReadOnlyCollection<GameDto>> Get()
{
var username = User.Identity?.Name ?? "anonymous";
_logger.Log(LogLevel.Information, "Get games started by {username}", username);
var allGames = _repository.Get().ToList();
_logger.Log(LogLevel.Information, "Getting games complete");
return allGames;
}

[HttpGet("{id}")]
public ActionResult<GameDto> Get(string id)
Expand Down

0 comments on commit 3fdca0a

Please sign in to comment.