import { EOL } from 'os' ; import { enabled as supportsColor } from 'colors/safe' ; import { ITerminalProvider , TerminalProviderSeverity } from './ITerminalProvider' ; /**
 * Options to be provided to a  ConsoleTerminalProvider beta export interface IConsoleTerminalProviderOptions { /**
     * If true, print verbose logging messages.
     */ verboseEnabled : boolean ; /**
     * If true, print debug logging messages. Note that "verbose" and "debug" are considered
     * separate message filters; if you want debug to imply verbose, it is up to your
     * application code to enforce that.
     */ debugEnabled : boolean ; } beta export class ConsoleTerminalProvider implements ITerminalProvider { /**
     * If true, verbose-level messages should be written to the console.
     */ public verboseEnabled : boolean = false ; /**
     * If true, debug-level messages should be written to the console.
     */ public debugEnabled : boolean = false ; public constructor ( options = { } ) { this . verboseEnabled = ! ! options . verboseEnabled ; this . debugEnabled = ! ! options . debugEnabled ; } /**
     * {@inheritDoc ITerminalProvider.write}
     */ public write ( data , severity ) { switch ( severity ) { case TerminalProviderSeverity . warning : case TerminalProviderSeverity . error : { process . stderr . write ( data ) ; break ; } case TerminalProviderSeverity . verbose : { if ( this . verboseEnabled ) { process . stdout . write ( data ) ; } break ; } case TerminalProviderSeverity . debug : { if ( this . debugEnabled ) { process . stdout . write ( data ) ; } break ; } case TerminalProviderSeverity . log : default : { process . stdout . write ( data ) ; break ; } } } /**
     * {@inheritDoc ITerminalProvider.eolCharacter}
     */ public get eolCharacter ( ) : string { return EOL ; } /**
     * {@inheritDoc ITerminalProvider.supportsColor}
     */ public get supportsColor ( ) : boolean { return supportsColor ; } }