b8c6dabfb7
* enabling eslint on the all packages and tests * enabling for all packages * TEMP: adding an only() test to verify it fails CI * using our eslint config and ignore in CI * removing the temporary .only() test * update lock file * lint: fixing new test with a no-shadow warning * chore: update lock file
46 lines
888 B
TypeScript
46 lines
888 B
TypeScript
// @internal
|
|
export interface ILogger {
|
|
info(msg: string): void;
|
|
success(msg: string): void;
|
|
warn(msg: string): void;
|
|
error(msg: string): void;
|
|
}
|
|
|
|
// @internal
|
|
export class Logger implements ILogger {
|
|
private colors = {
|
|
reset: '\x1b[0m',
|
|
fg: {
|
|
red: '\x1b[31m',
|
|
green: '\x1b[32m',
|
|
yellow: '\x1b[33m',
|
|
},
|
|
} as const;
|
|
|
|
private packageName: string;
|
|
|
|
constructor(packageName: string) {
|
|
this.packageName = packageName;
|
|
}
|
|
|
|
private log(msg: string, prefix = '') {
|
|
// eslint-disable-next-line no-console
|
|
console.log(`%s${this.packageName}:%s ${msg}\n`, prefix, prefix ? this.colors.reset : '');
|
|
}
|
|
|
|
info(msg: string) {
|
|
this.log(msg);
|
|
}
|
|
|
|
success(msg: string) {
|
|
this.log(msg, this.colors.fg.green);
|
|
}
|
|
|
|
warn(msg: string) {
|
|
this.log(`Skipped!\n${msg}`, this.colors.fg.yellow);
|
|
}
|
|
|
|
error(msg: string) {
|
|
this.log(`Failed!\n${msg}`, this.colors.fg.red);
|
|
}
|
|
}
|