Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Disable ANSI colors in logger output for non-interactive environments
Turn off colorized log output when logs are written to files or shipped to aggregators, since ANSI escape codes corrupt non-TTY output.
Bad example
| 1 | const app = await NestFactory.create(AppModule, { |
| 2 | logger: { |
| 3 | levels: logLevels, |
| 4 | }, |
| 5 | }); |
Explanation (EN)
With colors left on by default, file and aggregator output is littered with raw ANSI escape sequences that hurt readability and parsing.
Objašnjenje (HR)
Kad su boje ostavljene ukljucene, izlaz u datoteke i agregatore pun je sirovih ANSI escape sekvenci koje smetaju citljivosti i parsiranju.
Good example
| 1 | const app = await NestFactory.create(AppModule, { |
| 2 | logger: { |
| 3 | levels: logLevels, |
| 4 | colors: false, |
| 5 | }, |
| 6 | }); |
Explanation (EN)
Plain-text logs are clean in files and parse cleanly in log pipelines.
Objašnjenje (HR)
Logovi u obicnom tekstu su cisti u datotekama i uredno se parsiraju u log pipelineima.
Exceptions / Tradeoffs (EN)
Colors are fine (and helpful) for local development when output goes to an interactive terminal (TTY).
Iznimke / Tradeoffi (HR)
Boje su u redu (i korisne) za lokalni razvoj kada izlaz ide u interaktivni terminal (TTY).