Skip to content

Commit

Permalink
BCMOHAM-16286 Logging Update: added controller logging
Browse files Browse the repository at this point in the history
  • Loading branch information
daveb-hni committed Mar 8, 2024
1 parent 984e2ce commit 16afc2f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Services/Common/src/Controllers/ServiceBaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,16 @@ public ServiceBaseController(
[Authorize]
protected async Task<ActionResult<DocumentReference>> PharmanetRequest()
{
Logger.LogInformation(this.logger, $"ServiceBaseController.PharmanetRequest start");

ClaimsPrincipal? user = this.HttpContext!.User;

var traceId = this.Request.Headers.TryGetValue("X-Amzn-Trace-Id", out var value) ? value.SingleOrDefault() : null;

Check failure on line 118 in Services/Common/src/Controllers/ServiceBaseController.cs

View workflow job for this annotation

GitHub Actions / build

'StringValues' does not contain a definition for 'SingleOrDefault' and no accessible extension method 'SingleOrDefault' accepting a first argument of type 'StringValues' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 118 in Services/Common/src/Controllers/ServiceBaseController.cs

View workflow job for this annotation

GitHub Actions / build

'StringValues' does not contain a definition for 'SingleOrDefault' and no accessible extension method 'SingleOrDefault' accepting a first argument of type 'StringValues' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 118 in Services/Common/src/Controllers/ServiceBaseController.cs

View workflow job for this annotation

GitHub Actions / build

'StringValues' does not contain a definition for 'SingleOrDefault' and no accessible extension method 'SingleOrDefault' accepting a first argument of type 'StringValues' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 118 in Services/Common/src/Controllers/ServiceBaseController.cs

View workflow job for this annotation

GitHub Actions / build

'StringValues' does not contain a definition for 'SingleOrDefault' and no accessible extension method 'SingleOrDefault' accepting a first argument of type 'StringValues' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 118 in Services/Common/src/Controllers/ServiceBaseController.cs

View workflow job for this annotation

GitHub Actions / build

'StringValues' does not contain a definition for 'SingleOrDefault' and no accessible extension method 'SingleOrDefault' accepting a first argument of type 'StringValues' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 118 in Services/Common/src/Controllers/ServiceBaseController.cs

View workflow job for this annotation

GitHub Actions / build

'StringValues' does not contain a definition for 'SingleOrDefault' and no accessible extension method 'SingleOrDefault' accepting a first argument of type 'StringValues' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 118 in Services/Common/src/Controllers/ServiceBaseController.cs

View workflow job for this annotation

GitHub Actions / build

'StringValues' does not contain a definition for 'SingleOrDefault' and no accessible extension method 'SingleOrDefault' accepting a first argument of type 'StringValues' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 118 in Services/Common/src/Controllers/ServiceBaseController.cs

View workflow job for this annotation

GitHub Actions / build

'StringValues' does not contain a definition for 'SingleOrDefault' and no accessible extension method 'SingleOrDefault' accepting a first argument of type 'StringValues' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 118 in Services/Common/src/Controllers/ServiceBaseController.cs

View workflow job for this annotation

GitHub Actions / build

'StringValues' does not contain a definition for 'SingleOrDefault' and no accessible extension method 'SingleOrDefault' accepting a first argument of type 'StringValues' could be found (are you missing a using directive or an assembly reference?)
Logger.LogInformation(this.logger, $"ServiceBaseController.PharmanetRequest: X-Amzn-Trace-Id header: {traceId}");

string jsonString = await this.Request.GetRawBodyStringAsync().ConfigureAwait(true);
Logger.LogInformation(this.logger, $"ServiceBaseController.PharmanetRequest got the body from the request");

DocumentReference fhirRequest;
Message hl7v2Message;
try
Expand Down Expand Up @@ -155,6 +162,7 @@ protected async Task<ActionResult<DocumentReference>> PharmanetRequest()

FhirJsonSerializer serializer = new FhirJsonSerializer(new SerializerSettings() { Pretty = true });

Logger.LogInformation(this.logger, $"ServiceBaseController.PharmanetRequest: X-Amzn-Trace-Id header: {traceId} end");
return new ContentResult()
{
Content = serializer.SerializeToString(docRef),
Expand Down

0 comments on commit 16afc2f

Please sign in to comment.