diff --git a/modules/angular2/src/core/dom/browser_adapter.dart b/modules/angular2/src/core/dom/browser_adapter.dart index 6cc018b09a..8e7641a29e 100644 --- a/modules/angular2/src/core/dom/browser_adapter.dart +++ b/modules/angular2/src/core/dom/browser_adapter.dart @@ -157,6 +157,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { logGroup(error) { window.console.group(error); + this.logError(error); } logGroupEnd() { diff --git a/modules/angular2/src/core/dom/browser_adapter.ts b/modules/angular2/src/core/dom/browser_adapter.ts index 2a6508dcdb..20b0129e00 100644 --- a/modules/angular2/src/core/dom/browser_adapter.ts +++ b/modules/angular2/src/core/dom/browser_adapter.ts @@ -64,13 +64,20 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { } // TODO(tbosch): move this into a separate environment class once we have it - logError(error) { window.console.error(error); } + logError(error) { + if (window.console.error) { + window.console.error(error); + } else { + window.console.log(error); + } + } log(error) { window.console.log(error); } logGroup(error) { if (window.console.group) { window.console.group(error); + this.logError(error); } else { window.console.log(error); } diff --git a/modules/angular2/src/core/dom/parse5_adapter.ts b/modules/angular2/src/core/dom/parse5_adapter.ts index 8804c66c4a..db4ef73f1c 100644 --- a/modules/angular2/src/core/dom/parse5_adapter.ts +++ b/modules/angular2/src/core/dom/parse5_adapter.ts @@ -52,7 +52,7 @@ export class Parse5DomAdapter extends DomAdapter { log(error) { console.log(error); } - logGroup(error) { console.log(error); } + logGroup(error) { console.error(error); } logGroupEnd() {} diff --git a/modules/angular2/src/core/exception_handler.ts b/modules/angular2/src/core/exception_handler.ts index 84c11bad1b..d8c06f6556 100644 --- a/modules/angular2/src/core/exception_handler.ts +++ b/modules/angular2/src/core/exception_handler.ts @@ -5,6 +5,7 @@ import {ListWrapper, isListLikeIterable} from 'angular2/src/core/facade/collecti class _ArrayLogger { res: any[] = []; log(s: any): void { this.res.push(s); } + logError(s: any): void { this.res.push(s); } logGroup(s: any): void { this.res.push(s); } logGroupEnd(){}; } @@ -49,26 +50,26 @@ export class ExceptionHandler { this.logger.logGroup(`EXCEPTION: ${exception}`); if (isPresent(stackTrace) && isBlank(originalStack)) { - this.logger.log("STACKTRACE:"); - this.logger.log(this._longStackTrace(stackTrace)); + this.logger.logError("STACKTRACE:"); + this.logger.logError(this._longStackTrace(stackTrace)); } if (isPresent(reason)) { - this.logger.log(`REASON: ${reason}`); + this.logger.logError(`REASON: ${reason}`); } if (isPresent(originalException)) { - this.logger.log(`ORIGINAL EXCEPTION: ${originalException}`); + this.logger.logError(`ORIGINAL EXCEPTION: ${originalException}`); } if (isPresent(originalStack)) { - this.logger.log("ORIGINAL STACKTRACE:"); - this.logger.log(this._longStackTrace(originalStack)); + this.logger.logError("ORIGINAL STACKTRACE:"); + this.logger.logError(this._longStackTrace(originalStack)); } if (isPresent(context)) { - this.logger.log("ERROR CONTEXT:"); - this.logger.log(context); + this.logger.logError("ERROR CONTEXT:"); + this.logger.logError(context); } this.logger.logGroupEnd(); diff --git a/modules/angular2/src/web_workers/worker/application_common.ts b/modules/angular2/src/web_workers/worker/application_common.ts index 5e313f94c4..eab810d027 100644 --- a/modules/angular2/src/web_workers/worker/application_common.ts +++ b/modules/angular2/src/web_workers/worker/application_common.ts @@ -71,6 +71,7 @@ var _rootBindings = [bind(Reflector).toValue(reflector)]; class PrintLogger { log = print; + logError = print; logGroup = print; logGroupEnd() {} } diff --git a/modules/angular2/test/core/application_spec.ts b/modules/angular2/test/core/application_spec.ts index 749265617c..203fb1b90b 100644 --- a/modules/angular2/test/core/application_spec.ts +++ b/modules/angular2/test/core/application_spec.ts @@ -69,6 +69,7 @@ class HelloRootDirectiveIsNotCmp { class _ArrayLogger { res: any[] = []; log(s: any): void { this.res.push(s); } + logError(s: any): void { this.res.push(s); } logGroup(s: any): void { this.res.push(s); } logGroupEnd(){}; } diff --git a/modules/angular2/test/router/route_config_spec.ts b/modules/angular2/test/router/route_config_spec.ts index d72b130286..6cd0696dcd 100644 --- a/modules/angular2/test/router/route_config_spec.ts +++ b/modules/angular2/test/router/route_config_spec.ts @@ -33,6 +33,7 @@ import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy'; class _ArrayLogger { res: any[] = []; log(s: any): void { this.res.push(s); } + logError(s: any): void { this.res.push(s); } logGroup(s: any): void { this.res.push(s); } logGroupEnd(){}; }