Skip to content

Commit 8edd820

Browse files
committed
Select alternative debug method, fixes #62.
1 parent 62f1686 commit 8edd820

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/core/logger.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export class Options {
2222
storeAs: string;
2323
}
2424

25+
// For browsers that don't implement the debug method, log will be used instead. Fixes #62.
26+
const CONSOLE_DEBUG_METHOD = console["debug"] ? "debug" : "log";
27+
2528
// Temporal until https://github.com/angular/angular/issues/7344 gets fixed.
2629
const DEFAULT_OPTIONS: Options = {
2730
level: Level.WARN,
@@ -39,7 +42,7 @@ export class Logger {
3942
private _store: boolean;
4043
private _storeAs: string;
4144

42-
Level:any = Level;
45+
Level: any = Level;
4346

4447
constructor( @Optional() options?: Options ) {
4548

@@ -72,7 +75,7 @@ export class Logger {
7275
}
7376

7477
debug(message?: any, ...optionalParams: any[]) {
75-
this.isDebugEnabled() && console.debug.apply( console, arguments );
78+
this.isDebugEnabled() && ( <any> console )[ CONSOLE_DEBUG_METHOD ].apply( console, arguments );
7679
}
7780

7881
log(message?: any, ...optionalParams: any[]) {

0 commit comments

Comments
 (0)