stylized console logging for development and production builds
#1 393 ouverte le 19 janv. 2025
Métriques du dépôt
- Stars
- (132 étoiles)
- Métriques de merge PR
- (Merge moyen 25j 20h) (29 PRs mergées en 30 j)
Description
Type of Change
Enhancement
Summary
It would be nice to get some stylized console log coloring for supported terminals to better help distinguish normal console logs from warning or errors.
For example, especially when logging out warning from the import map generator, coloring these in yellow would be nice.
Details
I think it would be great to create some logging utilities with some pre-defined methods we can use to provide pre-stylized text
logLog- basically the same as just normalconsole.logoutputlogWarn- usesconsole.warnbut with yellow / amber colored textlogError- usesconsole.errorbut with red textlogSuccess- - usesconsole.logbut with green text (to signify the completion of key tasks within Greenwood on a case by case basis)
I would say we could use NodeJS
styleTextbut it is only in >= 22.x it seems, so we might have to manually do it for now. This guide has some suggestions using ANSI colors (I don't think we nee to use any dependencies for this).
Also, as observed in #1548 , once we have our own logging utility, we should probably add an ESLint rule to error out on console usage