You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lib/src/util/logging/StandardLogger.ts

15 lines
488 B

import {Logger} from "./Logger";
import {LogMessage} from "./types";
import * as color from 'colors/safe'
/**
* A Logger implementation that writes to the console.
*/
export class StandardLogger extends Logger {
public write(message: LogMessage) {
const prefix = this.levelDisplay(message.level)
const text = `${prefix} ${color.gray(this.formatDate(message.date))} (${color.cyan(message.callerName || 'Unknown')})`
console.log(text, message.output)
}
}