Skip to content

Instantly share code, notes, and snippets.

@badpenguin
Last active December 29, 2016 10:02
Show Gist options
  • Save badpenguin/0ddeac8bb665d5057e52625374f925cf to your computer and use it in GitHub Desktop.
Save badpenguin/0ddeac8bb665d5057e52625374f925cf to your computer and use it in GitHub Desktop.
/*
* simple replacement for angular1 $log service
* https://www.antoniogallo.it/
*/
declare var console: any;
export class $log {
static has_debug: boolean = true;
static error( ...args: any[] ) : void {
( console && console.error ) && console.error( ...args );
}
static warn( ...args: any[] ) : void {
( console && console.warn ) && console.warn( ...args );
}
static info( ...args: any[] ) : void {
( console && console.info ) && console.info( ...args );
}
static debug( ...args: any[] ) : void {
( $log.has_debug && console && console.debug ) && console.debug( ...args );
}
static log( ...args: any[] ) : void {
( console && console.log ) && console.log( ...args );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment