nest icon indicating copy to clipboard operation
nest copied to clipboard

feat(common): ConsoleLogger: extract protected formatTimestampDiff

Open armujahid opened this issue 3 years ago • 1 comments
trafficstars

allow overriding of timestampDiff formating

PR Checklist

Please check if your PR fulfills the following requirements:

  • [X] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [X] Feature
  • [ ] Code style update (formatting, local variables)
  • [x] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Other... Please describe:

What is the current behavior?

Currently there is no way to override timestampDiff formating by extending ConsoleLogger. This feature is required if we want to extend and create JsonConsoleLogger that emits json without any formating Related: https://github.com/nestjs/nest/issues/10342

What is the new behavior?

We can now override contextMessage formating by overriding formatTimestampDiff method

Does this PR introduce a breaking change?

  • [ ] Yes
  • [X] No

Other information

Related: https://github.com/nestjs/nest/pull/10364

armujahid avatar Oct 05 '22 12:10 armujahid

Pull Request Test Coverage Report for Build 5a8a33f4-24ee-4542-a6a6-1e5ddfd62faa

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.786%

Totals Coverage Status
Change from base Build 4101b12a-839e-4604-a959-3a51a70610ed: 0.0%
Covered Lines: 6113
Relevant Lines: 6518

💛 - Coveralls

coveralls avatar Oct 05 '22 12:10 coveralls

lgtm

kamilmysliwiec avatar Oct 21 '22 15:10 kamilmysliwiec