ProjectEvergreen/greenwood

stylized console logging for development and production builds

开放

#1,393 创建于 2025年1月19日

 (0 条评论) (0 个反应) (0 位负责人)JavaScript (15 个派生)auto 404
CLIenhancementgood first issue

仓库指标

星标
 (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.

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

贡献者指南