5.0.361 • Published 6 years ago

ibm-wch-sdk-ng-logger v5.0.361

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Logging implementation for ibm-wch-sdk-ng based on ng2-logger.

Changes

CHANGELOG

Usage

Install via npm

npm install --save ibm-wch-sdk-ng-logger

Add to your application module:

import { WchNgLoggingModule } from 'ibm-wch-sdk-ng-logger';

@NgModule({
  imports: [
    WchNgLoggingModule.forRoot(),
  ]
})

Configuration

You can enable logging for certain logging levels or modules by either providing a config object to the module, setting variables on localStorage or by setting a cookie. Both approaches use the same keys and expect string array serialized in JSON format as a value.

Modules

Use Ng2LoggerFactory.onlyModules as the key. The value array lists names of the modules or a regular expression string matching the modules. See the documentation for ng2-logger for more details.

Levels

Use Ng2LoggerFactory.onlyLevel as the key. The value array lists the logging levels, e.g DATA, INFO, WARN or ERROR. See the documentation for ng2-logger for more details.

Example

Enable logging just for the AbstractNavigationComponent via the local storage. In the console of your browser type:

localStorage.setItem('Ng2LoggerFactory.onlyModules', JSON.stringify(['AbstractNavigationComponent']))

Class documentation

Refer to the documentation.

Changelog

Current

Changed

  • Using ng2-logger/client instead of ng2-logger

Added

  • Adding support for cookie based logging config

5.0.223

Added

  • Initial version

ibm-wch-sdk-ng-logger

Index

External modules


ibm-wch-sdk-ng-logger > "index"

External module: "index"

Index


ibm-wch-sdk-ng-logger > "module"

External module: "module"

Index

Classes


ibm-wch-sdk-ng-logger > "services/config/wch.logger.config"

External module: "services/config/wch.logger.config"

Index

Classes

Interfaces


ibm-wch-sdk-ng-logger > "services/logger.factory"

External module: "services/logger.factory"

Index

Classes

Variables

Functions


Variables

<Const> KEY_ONLY_LEVEL

● KEY_ONLY_LEVEL: "Ng2LoggerFactory.onlyLevel" = "Ng2LoggerFactory.onlyLevel"

Defined in services/logger.factory.ts:10


<Const> KEY_ONLY_MODULES

● KEY_ONLY_MODULES: "Ng2LoggerFactory.onlyModules" = "Ng2LoggerFactory.onlyModules"

Defined in services/logger.factory.ts:9


<Const> _DEV_MODE_LOGGING

● _DEV_MODE_LOGGING: string[] = undefined

Defined in services/logger.factory.ts:118


<Const> _PROD_MODE_LOGGING

● _PROD_MODE_LOGGING: string[] = 'ERROR'

Defined in services/logger.factory.ts:115


<Const> _decode

● _decode: decodeURIComponent = decodeURIComponent

Defined in services/logger.factory.ts:85


Functions

<Const> _enableDefault

_enableDefault(): boolean

Defined in services/logger.factory.ts:123

Display only error logs per default

Returns: boolean


<Const> _enableFromConfig

_enableFromConfig(aConfig?: Ng2LoggerConfigService): boolean

Defined in services/logger.factory.ts:50

Enable logging based on config

Parameters:

ParamTypeDescription
Optional aConfigNg2LoggerConfigServicethe config

Returns: boolean true if logging has been enabled, else false


<Const> _enableFromCookies

_enableFromCookies(): boolean

Defined in services/logger.factory.ts:92

Enable logging based on cookies

Returns: boolean true if logging has been enabled, else false


<Const> _enableFromLocalStorage

_enableFromLocalStorage(): boolean

Defined in services/logger.factory.ts:79

Enable logging based on local storage

Returns: boolean true if logging has been enabled, else false


<Const> _enableLevels

_enableLevels(aLevels: string[], aModules: string[]): boolean

Defined in services/logger.factory.ts:21

Enable logging levels

Parameters:

ParamTypeDescription
aLevelsstring[]the levels
aModulesstring[]the modules

Returns: boolean


<Const> _isStringArray

_isStringArray(aArray: any): boolean

Defined in services/logger.factory.ts:13

Parameters:

ParamType
aArrayany

Returns: boolean


<Const> _parseStringToStringArray

_parseStringToStringArray(aValue?: string): string[] | undefined

Defined in services/logger.factory.ts:61

Safely parses a string

Parameters:

ParamTypeDescription
Optional aValuestringthe value

Returns: string[] | undefined

the string array


ibm-wch-sdk-ng-logger

Index

External modules


ibm-wch-sdk-ng-logger > "module" > WchNgLoggingModule

Class: WchNgLoggingModule

Hierarchy

WchNgLoggingModule

Index

Constructors

Methods


Constructors

constructor

new WchNgLoggingModule(parentModule: WchNgLoggingModule): WchNgLoggingModule

Defined in module.ts:30

Parameters:

ParamType
parentModuleWchNgLoggingModule

Returns: WchNgLoggingModule


Methods

<Static> forRoot

forRoot(aConfig?: Ng2LoggerConfig): ModuleWithProviders

Defined in module.ts:22

Parameters:

ParamType
Optional aConfigNg2LoggerConfig

Returns: ModuleWithProviders


ibm-wch-sdk-ng-logger > "services/config/wch.logger.config" > Ng2LoggerConfigService

Class: Ng2LoggerConfigService

Hierarchy

Ng2LoggerConfigService

Implements

Index

Properties


Properties

<Optional> onlyLevel

● onlyLevel: string[]

Implementation of Ng2LoggerConfig.onlyLevel

Defined in services/config/wch.logger.config.ts:31


<Optional> onlyModules

● onlyModules: string[]

Implementation of Ng2LoggerConfig.onlyModules

Defined in services/config/wch.logger.config.ts:26


ibm-wch-sdk-ng-logger > "services/config/wch.logger.config" > Ng2LoggerConfig

Interface: Ng2LoggerConfig

Hierarchy

Ng2LoggerConfig

Implemented by

Index

Properties


Properties

<Optional> onlyLevel

● onlyLevel: string[]

Defined in services/config/wch.logger.config.ts:17


<Optional> onlyModules

● onlyModules: string[]

Defined in services/config/wch.logger.config.ts:12


ibm-wch-sdk-ng-logger > "services/logger.factory" > Ng2LoggerFactory

Class: Ng2LoggerFactory

Hierarchy

Ng2LoggerFactory

Implements

  • LoggerFactory

Index

Constructors

Properties


Constructors

constructor

new Ng2LoggerFactory(aConfig?: Ng2LoggerConfigService): Ng2LoggerFactory

Defined in services/logger.factory.ts:132

Parameters:

ParamType
Optional aConfigNg2LoggerConfigService

Returns: Ng2LoggerFactory


Properties

create

● create: create = Log.create

Defined in services/logger.factory.ts:132


5.0.361

6 years ago

5.0.341

6 years ago

5.0.340

6 years ago

5.0.334

6 years ago

5.0.321

6 years ago

5.0.325

6 years ago

5.0.316

6 years ago

5.0.314

6 years ago

5.0.300

6 years ago

5.0.269

6 years ago

5.0.265

6 years ago

5.0.258

6 years ago

5.0.254

6 years ago

5.0.240

6 years ago

5.0.238

6 years ago

5.0.233

6 years ago

5.0.226

6 years ago

5.0.217

6 years ago

5.0.216

6 years ago

5.0.215

6 years ago

5.0.211

6 years ago

5.0.210

6 years ago