'use strict' ; import * as vscode from 'vscode' ; export class Logger { static showError ( message , error ? ) { vscode . window . showErrorMessage ( message ) ; this . outputError ( error ) ; } static showInfo ( message , error ? ) { vscode . window . showInformationMessage ( message ) ; this . outputMessage ( message ) ; if ( error ) { this . outputMessage ( error . message ) ; } } static showWarning ( message , error ? ) { vscode . window . showWarningMessage ( message ) ; this . outputWarning ( message ) ; if ( error ) { this . outputWarning ( error . message ) ; } } static outputMessage ( message , outputChannel ? ) { outputChannel = outputChannel || vscode . window . spgo . outputChannel ; this . formatOutputMessage ( message , outputChannel ) ; } static outputWarning ( message , outputChannel ? ) { outputChannel = outputChannel || vscode . window . spgo . outputChannel ; this . formatOutputMessage ( message , outputChannel ) ; } static outputError ( error , outputChannel ? ) { if ( error ) { outputChannel = outputChannel || vscode . window . spgo . outputChannel ; this . formatOutputMessage ( '================================     ERROR     ================================' , outputChannel ) ; if ( error . message ) { this . formatOutputMessage ( error . message , outputChannel ) ; } this . formatOutputMessage ( 'Error Detail:' , outputChannel ) ; this . formatOutputMessage ( '----------------------' , outputChannel ) ; this . formatOutputMessage ( error , outputChannel ) ; this . formatOutputMessage ( '===============================================================================' , outputChannel ) ; } } static formatOutputMessage ( message , outputChannel ? ) { outputChannel . appendLine ( `[${ new Date ( Date . now ( ) ) . toLocaleString ( ) }] ${ message }` ) ; } static updateStatusBar ( message , duration ? ) { this . outputMessage ( message ) ; vscode . window . spgo . statusBarItem . text = message ; if ( duration ) { global . setTimeout ( ( ) => { vscode . window . spgo . statusBarItem . text = '' ; } , duration * 1000 ) ; } } }