message: feat: Add support for NO_COLOR environment variable
diff: @@ -25,10 +25,25 @@ const Colors = {
  };
  const messagePrefixes = {
  - [LogLevel.Error]: `${Colors.red}Error: ${Colors.reset}`,
  - [LogLevel.Warn]: `${Colors.yellow}Warning: ${Colors.reset}`,
  - [LogLevel.Info]: `${Colors.cyan}Info: ${Colors.reset}`,
  - [LogLevel.Verbose]: `${Colors.gray}Debug: ${Colors.reset}`,
  + [LogLevel.Error]: "Error: ",
  + [LogLevel.Warn]: "Warning: ",
  + [LogLevel.Info]: "Info: ",
  + [LogLevel.Verbose]: "Debug: ",
  +};
  +
  +const coloredMessagePrefixes = {
  + [LogLevel.Error]: `${Colors.red}${messagePrefixes[LogLevel.Error]}${
  + Colors.reset
  + }`,
  + [LogLevel.Warn]: `${Colors.yellow}${messagePrefixes[LogLevel.Warn]}${
  + Colors.reset
  + }`,
  + [LogLevel.Info]: `${Colors.cyan}${messagePrefixes[LogLevel.Info]}${
  + Colors.reset
  + }`,
  + [LogLevel.Verbose]: `${Colors.gray}${messagePrefixes[LogLevel.Verbose]}${
  + Colors.reset
  + }`,
  };
  /**
  @@ -235,6 +250,19 @@ export class Logger {
  * A logger that outputs all messages to the console.
  */
  export class ConsoleLogger extends Logger {
  + /**
  + * Specifies if the logger is using color codes in its output.
  + */
  + private hasColoredOutput: boolean;
  +
  + /**
  + * Create a new ConsoleLogger instance.
  + */
  + constructor() {
  + super();
  + this.hasColoredOutput = !("NO_COLOR" in process.env);
  + }
  +
  /**
  * Print a log message.
  *
  @@ -256,7 +284,11 @@ export class ConsoleLogger extends Logger {
  } as const
  )[level];
  - console[method](messagePrefixes[level] + message);
  + const prefix = this.hasColoredOutput
  + ? coloredMessagePrefixes[level]
  + : messagePrefixes[level];
  +
  + console[method](prefix + message);
  }
  }
  