Skip to content

Commit dc93db2

Browse files
971 | Fixes log issue (#392)
* 971 | Fixes log issue * 971 | fixes build failed issue
1 parent 72cd72a commit dc93db2

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/In.ProjectEKA.HipService/User/UserController.cs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ namespace In.ProjectEKA.HipService.User
44
using Common;
55
using Gateway;
66
using Hangfire;
7+
using Logger;
78
using Microsoft.AspNetCore.Mvc;
8-
using Microsoft.Extensions.Logging;
99
using Newtonsoft.Json.Linq;
1010
using static Common.Constants;
1111

@@ -14,14 +14,11 @@ public class UserController : ControllerBase
1414
{
1515
private readonly IBackgroundJobClient backgroundJob;
1616
private readonly GatewayClient gatewayClient;
17-
private readonly ILogger<UserController> logger;
1817

19-
public UserController(IBackgroundJobClient backgroundJob, GatewayClient gatewayClient,
20-
ILogger<UserController> logger)
18+
public UserController(IBackgroundJobClient backgroundJob, GatewayClient gatewayClient)
2119
{
2220
this.backgroundJob = backgroundJob;
2321
this.gatewayClient = gatewayClient;
24-
this.logger = logger;
2522
}
2623

2724
[HttpPost(Constants.AUTH_CONFIRM)]
@@ -54,25 +51,24 @@ public async Task OnAuthConfirmFor(JObject response)
5451
if (authOnConfirmResponse.Error == null)
5552
{
5653
if (authOnConfirmResponse.Auth.AccessToken != null)
57-
logger.LogInformation($"Access Token is: {authOnConfirmResponse.Auth.AccessToken}");
54+
Log.Information($"Access Token is: {authOnConfirmResponse.Auth.AccessToken}");
5855
if (authOnConfirmResponse.Auth.Patient != null)
5956
{
60-
logger.LogInformation($"Patient Name is: {authOnConfirmResponse.Auth.Patient.Name}");
61-
logger.LogInformation($"Patient Id is: {authOnConfirmResponse.Auth.Patient.Id}");
62-
logger.LogInformation($"Patient Birth Year is: {authOnConfirmResponse.Auth.Patient.YearOfBirth}");
57+
Log.Information("Patient: "+$" Name: {authOnConfirmResponse.Auth.Patient.Name},"+
58+
$"Id: {authOnConfirmResponse.Auth.Patient.Id}, "+
59+
$"Birth Year: {authOnConfirmResponse.Auth.Patient.YearOfBirth}");
6360
if (authOnConfirmResponse.Auth.Patient.Address != null)
6461
{
65-
logger.LogInformation(
66-
$"Patient District is: {authOnConfirmResponse.Auth.Patient.Address.District}");
67-
logger.LogInformation($"Patient State is: {authOnConfirmResponse.Auth.Patient.Address.State}");
68-
logger.LogInformation($"Patient Line is: {authOnConfirmResponse.Auth.Patient.Address.Line}");
69-
logger.LogInformation(
70-
$"Patient Pincode is: {authOnConfirmResponse.Auth.Patient.Address.PinCode}");
62+
Log.Information("Patient Address Details: "+
63+
$" District: {authOnConfirmResponse.Auth.Patient.Address.District}, "+
64+
$" State: {authOnConfirmResponse.Auth.Patient.Address.State}, "+
65+
$" Line: {authOnConfirmResponse.Auth.Patient.Address.Line},"+
66+
$" Pincode: {authOnConfirmResponse.Auth.Patient.Address.PinCode}");
7167
}
7268
}
7369
}
7470
else
75-
logger.LogInformation($" Error Code:{authOnConfirmResponse.Error.Code}," +
71+
Log.Error($" Error Code:{authOnConfirmResponse.Error.Code}," +
7672
$" Error Message:{authOnConfirmResponse.Error.Message}.");
7773
}
7874
}

0 commit comments

Comments
 (0)