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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 82x 82x 5x 5x 5x 82x 4x 3x 1x 1x 1x 82x | import ErrorLogger, { ErrorLevelType, ErrorMeta, ErrorTags } from './ErrorLogger'; export interface ConsoleErrorLoggerOptions { console?: Console; errorTypes?: string[]; } // tslint:disable:no-console export default class ConsoleErrorLogger implements ErrorLogger { private console: Console; constructor( options?: ConsoleErrorLoggerOptions ) { const { console: customConsole = console, } = options || {}; this.console = customConsole; } log( error: Error, tags?: ErrorTags, level: ErrorLevelType = ErrorLevelType.Error, meta?: ErrorMeta ): void { switch (level) { case ErrorLevelType.Error: return this.console.error(error, tags, meta); case ErrorLevelType.Info: return this.console.info(error, tags, meta); case ErrorLevelType.Warning: return this.console.warn(error, tags, meta); default: return this.console.log(error, tags, meta); } } } |