nest icon indicating copy to clipboard operation
nest copied to clipboard

feat(common): Set ConsoleLogger prefix via env

Open jochongs opened this issue 1 year ago • 2 comments
trafficstars

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)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Other... Please describe:

What is the current behavior?

Issue Number: #13913 #13841

What is the new behavior?

In my previous PR, I overlooked the potential confusion caused by the useLogger method in the INestApplication interface.

I believe the issue at hand is to allow changing the prefix even when using the default ConsoleLogger provided by Nest.

Modifying INestApplication could lead to confusion with the useLogger method, so how about allowing the prefix to be changed via an environment variable instead?

This approach would enable changing the prefix through application runtime options without any code changes, making it the simplest solution to address the issue.

Do you foresee any potential issues with this approach, such as increasing code complexity or introducing other problems?

I would greatly appreciate your feedback.

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

jochongs avatar Sep 03 '24 06:09 jochongs