ProjectEvergreen/greenwood

stylized console logging for development and production builds

Ouverte

#1 393 ouverte le 19 janv. 2025

 (0 commentaire) (0 réaction) (0 personne assignée)JavaScript (15 forks)auto 404
CLIenhancementgood first issue

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.

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

Guide contributeur