From 463cb893e8a6005a39d8214a5674294ae8afc703 Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Sun, 23 Jul 2023 22:57:54 -0700 Subject: [PATCH] Logging update --- .../Controllers/v1/IdentityController.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Newsbot.Collector.Api/Controllers/v1/IdentityController.cs b/Newsbot.Collector.Api/Controllers/v1/IdentityController.cs index ddfd6e7..b260be5 100644 --- a/Newsbot.Collector.Api/Controllers/v1/IdentityController.cs +++ b/Newsbot.Collector.Api/Controllers/v1/IdentityController.cs @@ -1,10 +1,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Newsbot.Collector.Api.Domain; -using Newsbot.Collector.Api.Domain.Requests; -using Newsbot.Collector.Api.Domain.Response; -using Newsbot.Collector.Api.Domain.Results; -using Newsbot.Collector.Api.Services; +using Newsbot.Collector.Domain.Requests; +using Newsbot.Collector.Domain.Response; +using Newsbot.Collector.Domain.Results; +using Newsbot.Collector.Services; namespace Newsbot.Collector.Api.Controllers.v1; @@ -12,11 +12,13 @@ namespace Newsbot.Collector.Api.Controllers.v1; [Route("/api/v1/account")] public class IdentityController : ControllerBase { - private IIdentityService _identityService; + private readonly ILogger _logger; + private readonly IIdentityService _identityService; - public IdentityController(IIdentityService identityService) + public IdentityController(IIdentityService identityService, ILogger logger) { _identityService = identityService; + _logger = logger; } [HttpPost("register")] @@ -81,6 +83,7 @@ public class IdentityController : ControllerBase } catch (Exception ex) { + _logger.LogWarning(ex, "Failed to add role to user"); return new BadRequestResult(); } }