Migrate from window.console to LogService

This commit is contained in:
Denys Vuika
2017-01-05 21:06:30 +00:00
parent 2d98a04f87
commit d42f41ec00
106 changed files with 1177 additions and 1171 deletions

View File

@@ -17,13 +17,7 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import {
AlfrescoTranslationService,
AuthService,
SettingsService,
StorageService
} from 'ng2-alfresco-core';
import { AlfrescoTranslateService, AuthService, SettingsService, StorageService, LogService } from 'ng2-alfresco-core';
declare var document: any;
@@ -38,22 +32,23 @@ export class AppComponent {
ecmHost: string = 'http://' + window.location.hostname + ':8080';
bpmHost: string = 'http://' + window.location.hostname + ':9999';
constructor(public authService: AuthService,
public router: Router,
public settingsService: SettingsService,
private translate: AlfrescoTranslationService,
private storage: StorageService) {
constructor(private authService: AuthService,
private router: Router,
private settingsService: SettingsService,
private translateService: AlfrescoTranslateService,
private storage: StorageService,
private logService: LogService) {
this.setEcmHost();
this.setBpmHost();
this.setProvider();
if (translate) {
if (translateService) {
if (process.env.ENV === 'production') {
translate.addTranslationFolder('custom', 'i18n/custom-translation');
translate.addTranslationFolder('ng2-alfresco-login', 'i18n/custom-translation/alfresco-login');
translateService.addTranslationFolder('custom', 'i18n/custom-translation');
translateService.addTranslationFolder('ng2-alfresco-login', 'i18n/custom-translation/alfresco-login');
} else {
translate.addTranslationFolder('custom', 'custom-translation');
translate.addTranslationFolder('ng2-alfresco-login', 'custom-translation/alfresco-login');
translateService.addTranslationFolder('custom', 'custom-translation');
translateService.addTranslationFolder('ng2-alfresco-login', 'custom-translation/alfresco-login');
}
}
}
@@ -84,7 +79,7 @@ export class AppComponent {
if (error && error.response && error.response.status === 401) {
this.navigateToLogin();
} else {
console.error('An unknown error occurred while logging out', error);
this.logService.error('An unknown error occurred while logging out', error);
this.navigateToLogin();
}
}
@@ -107,7 +102,7 @@ export class AppComponent {
}
changeLanguage(lang: string) {
this.translate.use(lang);
this.translateService.use(lang);
this.hideDrawer();
}