ProjectEvergreen/greenwood

stylized console logging for development and production builds

オープン

#1,393 opened on 2025/01/19

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (15 件のフォーク)auto 404
CLIenhancementgood first issue

Repository metrics

Stars
 (132 個のスター)
PR merge metrics
 (平均マージ 25d 20h) (30d で 29 merged PRs)

説明

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.

Image

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 normal console.log output
  • logWarn - uses console.warn but with yellow / amber colored text
  • logError - uses console.error but with red text
  • logSuccess - - uses console.log but 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 styleText but 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

コントリビューターガイド