/**
 * Copyright 2018 Twitter, Inc.
 * Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0
 */ import * as util from "util" ; import { LogProperties , Logger } from "../api/log" ; export abstract class AbstractLogger implements Logger { abstract log ( level , props , format , ... param ) ; trace ( props , format , ... param ) { return this . log ( "trace" , props , format , ... param ) ; } debug ( props , format , ... param ) { return this . log ( "debug" , props , format , ... param ) ; } info ( props , format , ... param ) { return this . log ( "info" , props , format , ... param ) ; } warn ( props , format , ... param ) { return this . log ( "warn" , props , format , ... param ) ; } error ( props , format , ... param ) { return this . log ( "error" , props , format , ... param ) ; } fatal ( props , format , ... param ) { return this . log ( "fatal" , props , format , ... param ) ; } } export class ConsoleLogger extends AbstractLogger { log ( level , props , format , ... param ) { const message = util . format ( format , ... param ) ; console . error ( message ) ; if ( props . err && props . err . stack ) { console . error ( props . err . stack ) ; } } }