Skip to content

Conversation

@martincostello
Copy link
Owner

Support customising the format of the log message timestamps.

Resolves #311.

@martincostello martincostello added the enhancement New feature or request label May 17, 2022
@martincostello martincostello added this to the v0.3.0 milestone May 17, 2022
@codecov
Copy link

codecov bot commented May 17, 2022

Codecov Report

Merging #313 (18a6af8) into main (e21b1a5) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #313   +/-   ##
=======================================
  Coverage   99.41%   99.41%           
=======================================
  Files          15       15           
  Lines         340      340           
=======================================
  Hits          338      338           
  Misses          2        2           
Flag Coverage Δ
linux 99.41% <100.00%> (ø)
macos 99.41% <100.00%> (ø)
windows 99.41% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Logging.XUnit/XUnitLogger.cs 98.14% <100.00%> (-0.02%) ⬇️
...ogging.XUnit/XUnitLoggerExtensions.IMessageSink.cs 100.00% <100.00%> (ø)
...g.XUnit/XUnitLoggerExtensions.ITestOutputHelper.cs 100.00% <100.00%> (ø)
src/Logging.XUnit/XUnitLoggerOptions.cs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e21b1a5...18a6af8. Read the comment docs.

@martincostello
Copy link
Owner Author

Output examples for en-GB culture:

g

[17/05/2022 10:16] info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 POST http://localhost/api/values application/json;+charset=utf-8 2
[17/05/2022 10:16] info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'HTTP: POST /api/values'
[17/05/2022 10:16] info: Microsoft.AspNetCore.Http.Result.NoContentResult[1]
      Executing StatusCodeResult, setting HTTP status code 204.
[17/05/2022 10:16] info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'HTTP: POST /api/values'
[17/05/2022 10:16] info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 POST http://localhost/api/values application/json;+charset=utf-8 2 - 204 - - 32.1164ms

u

[2022-05-17 09:16:52Z] info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 POST http://localhost/api/values application/json;+charset=utf-8 2
[2022-05-17 09:16:52Z] info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'HTTP: POST /api/values'
[2022-05-17 09:16:52Z] info: Microsoft.AspNetCore.Http.Result.NoContentResult[1]
      Executing StatusCodeResult, setting HTTP status code 204.
[2022-05-17 09:16:52Z] info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'HTTP: POST /api/values'
[2022-05-17 09:16:52Z] info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 POST http://localhost/api/values application/json;+charset=utf-8 2 - 204 - - 33.1860ms

yyyy-MM-dd HH:mm:ss.fff

[2022-05-17 10:17:36.184] info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 POST http://localhost/api/values application/json;+charset=utf-8 2
[2022-05-17 10:17:36.205] info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'HTTP: POST /api/values'
[2022-05-17 10:17:36.211] info: Microsoft.AspNetCore.Http.Result.NoContentResult[1]
      Executing StatusCodeResult, setting HTTP status code 204.
[2022-05-17 10:17:36.211] info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'HTTP: POST /api/values'
[2022-05-17 10:17:36.214] info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 POST http://localhost/api/values application/json;+charset=utf-8 2 - 204 - - 32.4704ms

Bump version to 0.3.0 for the next release.
- Tidy up whitespace.
- Use expression-bodied property.
- Use interpolated string.
Make a number of lambda methods explicitly static.
Support customising the format of the timestamps.
Resolves #311.
Add TODO comment for [StringSyntax].
@martincostello martincostello force-pushed the custom-timestamp-format branch from 7dea32d to 18a6af8 Compare May 22, 2022 17:46
@martincostello martincostello merged commit c522f21 into main May 22, 2022
@martincostello martincostello deleted the custom-timestamp-format branch May 22, 2022 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Customization of the timestamp format

2 participants