All files Logger.ts

42.86% Statements 3/7
50% Branches 2/4
40% Functions 2/5
42.86% Lines 3/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 291x   1x       2x                                            
import chalk from 'chalk';
 
export default class Logger {
    verbose: Boolean;
 
    constructor(verbose: Boolean = false) {
        this.verbose = verbose;
    }
 
    log(msg: string): void {
        console.log(chalk.grey(msg));
    }
 
    info(msg: string, after: string = ''): void {
        if (this.verbose) {
            console.log(chalk.bold.blue(`[Info]`), msg, chalk.grey(after));
        }
    }
 
    warn(msg: string, after: string = ''): void {
        if (this.verbose) {
            console.log(chalk.bold.yellow(`[Warning] ${msg}`), chalk.yellow(after));
        }
    }
 
    error(msg: string, after: string = ''): void {
        console.log(chalk.bold.red(`[Error]: ${msg}`), chalk.red(after));
    }
}