@ibm-wch-sdk/typescript-logger
v7.2.608
Published
Support package for @ibm-wch-sdk/ng to add logging.
Downloads
1
Keywords
Readme
Logging implementation for ibm-wch-sdk-ng based on ng2-logger.
Changes
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 ofng2-logger
Added
- Adding support for cookie based logging config
5.0.223
Added
- Initial version
@ibm-wch-sdk/typescript-logger
Index
External modules
@ibm-wch-sdk/typescript-logger > "index"
External module: "index"
Index
@ibm-wch-sdk/typescript-logger > "module"
External module: "module"
Index
Classes
@ibm-wch-sdk/typescript-logger > "services/logger.factory"
External module: "services/logger.factory"
Index
Classes
@ibm-wch-sdk/typescript-logger
Index
External modules
@ibm-wch-sdk/typescript-logger > "module" > WchTypescriptLoggingModule
Class: WchTypescriptLoggingModule
Hierarchy
WchTypescriptLoggingModule
Index
Constructors
Methods
Constructors
constructor
⊕ new WchTypescriptLoggingModule(parentModule: WchTypescriptLoggingModule): WchTypescriptLoggingModule
Defined in module.ts:28
Parameters:
| Name | Type | | ------ | ------ | | parentModule | WchTypescriptLoggingModule |
Returns: WchTypescriptLoggingModule
Methods
<Static>
forRoot
▸ forRoot(): ModuleWithProviders
Defined in module.ts:21
Returns: ModuleWithProviders
@ibm-wch-sdk/typescript-logger > "services/logger.factory" > TypescriptLoggerService
Class: TypescriptLoggerService
Hierarchy
TypescriptLoggerService
Implements
LoggerFactory
Index
Constructors
Methods
Constructors
constructor
⊕ new TypescriptLoggerService(): TypescriptLoggerService
Defined in services/logger.factory.ts:7
Returns: TypescriptLoggerService
Methods
create
▸ create(name: string
): Logger
Defined in services/logger.factory.ts:10
Parameters:
| Name | Type |
| ------ | ------ |
| name | string
|
Returns: Logger