mirror of
https://github.com/actions/stale.git
synced 2026-01-02 05:18:18 +00:00
fix(logs): coloured logs (#465)
* refactor(logs): replace chalk by ansi-styles * test(logs): fix the failing tests due to ansi styles I was not able to disable or mock ansi-styles so instead I found a way to make the tests pass it's not perfect but it's still nice because the logs will keep their trustful colour when running through the tests * refactor(logs): simplify the syntax to colour the logs * chore(rebase): update files due to rebase * refactor(logger): reduce code duplication
This commit is contained in:
committed by
GitHub
parent
e884599072
commit
5fbbfba142
@@ -1,19 +1,19 @@
|
||||
import * as core from '@actions/core';
|
||||
import chalk from 'chalk';
|
||||
import terminalLink from 'terminal-link';
|
||||
import {Option} from '../../enums/option';
|
||||
import {LoggerService} from '../../services/logger.service';
|
||||
|
||||
export class Logger {
|
||||
warning(...message: string[]): void {
|
||||
core.warning(chalk.whiteBright(...message));
|
||||
core.warning(LoggerService.whiteBright(message.join(' ')));
|
||||
}
|
||||
|
||||
info(...message: string[]): void {
|
||||
core.info(chalk.whiteBright(...message));
|
||||
core.info(LoggerService.whiteBright(message.join(' ')));
|
||||
}
|
||||
|
||||
error(...message: string[]): void {
|
||||
core.error(chalk.whiteBright(...message));
|
||||
core.error(LoggerService.whiteBright(message.join(' ')));
|
||||
}
|
||||
|
||||
createLink(name: Readonly<string>, link: Readonly<string>): string {
|
||||
@@ -21,7 +21,7 @@ export class Logger {
|
||||
}
|
||||
|
||||
createOptionLink(option: Readonly<Option>): string {
|
||||
return chalk.magenta(
|
||||
return LoggerService.magenta(
|
||||
this.createLink(option, `https://github.com/actions/stale#${option}`)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user