stylized console logging for development and production builds
#1,393 创建于 2025年1月19日
仓库指标
- 星标
- (132 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
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