Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(common): account for when stack is undefined in logger #11081

Merged
merged 2 commits into from
Feb 8, 2023

Conversation

jmcdo29
Copy link
Member

@jmcdo29 jmcdo29 commented Feb 8, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

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

What is the current behavior?

Due to a change in #10531 when the stack is added as undefined a new undefined log would be added whenever this.logger.error() would be called.

Issue Number: #11074

What is the new behavior?

Now, we check that the last element is either a string or undefined, and if so strip the last element. That element should only exist when we artificially add the stack via the changes from #10531.

Does this PR introduce a breaking change?

  • Yes
  • No

This at least shouldn't be breaking. Added a new test to ensure it does what I expect it to as well.

Other information

Due to a change in nestjs#10531 when the `stack` is added as `undefined` a
new `undefined` log would be added whenever `this.logger.error()`
would be called. Now, we check that the last element is either
a string or undefined, and if so strip the last element. That element
should only exist when we artificially add the stack via the changes
from nestjs#10531.

closes nestjs#11074
@coveralls
Copy link

coveralls commented Feb 8, 2023

Pull Request Test Coverage Report for Build da944cb9-1f9c-4bfc-9622-15b0ed459a6a

  • 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 92.927%

Totals Coverage Status
Change from base Build 87b1d40c-8c24-4710-8c62-a3137e8d2971: 0.0%
Covered Lines: 6464
Relevant Lines: 6956

💛 - Coveralls

@kamilmysliwiec
Copy link
Member

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants