From 2d98a04f8715bdd3824637c55a2abdb8bacd78c4 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 5 Jan 2017 16:14:33 +0000 Subject: [PATCH] LogService implementation --- ng2-components/ng2-alfresco-core/README.md | 1 + ng2-components/ng2-alfresco-core/index.ts | 2 + .../ng2-alfresco-core/src/services/index.ts | 1 + .../src/services/log.service.ts | 51 +++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 ng2-components/ng2-alfresco-core/src/services/log.service.ts diff --git a/ng2-components/ng2-alfresco-core/README.md b/ng2-components/ng2-alfresco-core/README.md index 459deca8b3..1e4098830f 100644 --- a/ng2-components/ng2-alfresco-core/README.md +++ b/ng2-components/ng2-alfresco-core/README.md @@ -56,6 +56,7 @@ npm install --save ng2-alfresco-core ### Services +- **LogService**, log service implementation - **AlfrescoApiService**, provides access to Alfresco JS API instance - **AlfrescoAuthenticationService**, main authentication APIs - **AlfrescoTranslationService**, various i18n-related APIs diff --git a/ng2-components/ng2-alfresco-core/index.ts b/ng2-components/ng2-alfresco-core/index.ts index 52c133237f..4089ff40d3 100644 --- a/ng2-components/ng2-alfresco-core/index.ts +++ b/ng2-components/ng2-alfresco-core/index.ts @@ -33,6 +33,7 @@ import { AuthGuard, AuthGuardEcm, AuthGuardBpm, + LogService, /** @deprecated */ AlfrescoSettingsService, /** @deprecated */ AlfrescoTranslationService, @@ -48,6 +49,7 @@ export * from './src/components/index'; export * from './src/utils/index'; export const ALFRESCO_CORE_PROVIDERS: any[] = [ + LogService, AuthService, ContentService, SettingsService, diff --git a/ng2-components/ng2-alfresco-core/src/services/index.ts b/ng2-components/ng2-alfresco-core/src/services/index.ts index 591aa4245c..54f2d29e14 100644 --- a/ng2-components/ng2-alfresco-core/src/services/index.ts +++ b/ng2-components/ng2-alfresco-core/src/services/index.ts @@ -26,6 +26,7 @@ export * from './auth-guard.service'; export * from './auth-guard-ecm.service'; export * from './auth-guard-bpm.service'; +export * from './log.service'; export * from './auth.service'; export * from './content.service'; export * from './settings.service'; diff --git a/ng2-components/ng2-alfresco-core/src/services/log.service.ts b/ng2-components/ng2-alfresco-core/src/services/log.service.ts new file mode 100644 index 0000000000..6b7667857c --- /dev/null +++ b/ng2-components/ng2-alfresco-core/src/services/log.service.ts @@ -0,0 +1,51 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Injectable } from '@angular/core'; + +@Injectable() +export class LogService { + + get assert(): (message?: any, ...optionalParams: any[]) => void { + return console.error.bind(console); + } + + get error(): (message?: any, ...optionalParams: any[]) => void { + return console.error.bind(console); + } + + get group(): (message?: any, ...optionalParams: any[]) => void { + return console.error.bind(console); + } + + get groupEnd(): (message?: any, ...optionalParams: any[]) => void { + return console.error.bind(console); + } + + get info(): (message?: any, ...optionalParams: any[]) => void { + return console.info.bind(console); + } + + get log(): (message?: any, ...optionalParams: any[]) => void { + return console.log.bind(console); + } + + get warn(): (message?: any, ...optionalParams: any[]) => void { + return console.warn.bind(console); + } + +}