npm package: @ibm-wch-sdk/log4js-logger
Description: Support package for @ibm-wch-sdk/ng to add logging.
Author: Carsten Leue
Latest version: 7.2.608

<a name="_8288cff9ec4dbc1a1d241b9c9c346d34ec891d7baaf30d7ce96fe2e99849a4e4"></a>
Logging implementation for [ibm-wch-sdk-ng](https://www.npmjs.com/package/ibm-wch-sdk-ng) based on [ng2-logger](https://www.npmjs.com/package/ng2-logger).

## Changes

[CHANGELOG](#_6a4613fd54e183a25f5f9edc57afe92b6413b6c1cc4f70246cc9aff18b3878d8)

## Usage

Install via npm

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

Add to your application module:

```typescript
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](https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage) or by setting a [cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies). Both approaches use the same keys and expect string array serialized in [JSON format](https://www.json.org/) 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](https://www.npmjs.com/package/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](https://www.npmjs.com/package/ng2-logger) for more details.

### Example

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

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

## Class documentation

Refer to the [documentation](#_07fc3e3f0a90e5b4ec028dbdbbcb2ae68d690cf82df3975bd8efb74f0c36ba69).

<a name="_6a4613fd54e183a25f5f9edc57afe92b6413b6c1cc4f70246cc9aff18b3878d8"></a>
# 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
<a name="_07fc3e3f0a90e5b4ec028dbdbbcb2ae68d690cf82df3975bd8efb74f0c36ba69"></a>

#  @ibm-wch-sdk/log4js-logger

## Index

### External modules

* ["module"](#_6d90679a99ebdb130822c569554b3420ee4231cd958d1cf6efdd2942430420f1)
* ["public_api"](#_c380937aaec0cc30e999a61e063f7cdbcee5f09b7e1252862cf45d59b8edc808)
* ["services/logger.factory"](#_2d607afea4ba4c2a81cd8dc20cdc6f4753fba0ecb25cfea68fc5ff235a5b1e63)

---


<a name="_6d90679a99ebdb130822c569554b3420ee4231cd958d1cf6efdd2942430420f1"></a>
[@ibm-wch-sdk/log4js-logger](#_5e7167da50177490d07d2d9819695a358c9a90d385991650113f0ad1fd4448ce) > ["module"](#_6d90679a99ebdb130822c569554b3420ee4231cd958d1cf6efdd2942430420f1)

# External module: "module"

## Index

### Classes

* [WchLog4jsLoggingModule](#_3bc0635281f3c8aa681ad71f9d5a4dcd5d5961c0fc8a0bf9057a71f8c345c31b)

---


<a name="_c380937aaec0cc30e999a61e063f7cdbcee5f09b7e1252862cf45d59b8edc808"></a>
[@ibm-wch-sdk/log4js-logger](#_5e7167da50177490d07d2d9819695a358c9a90d385991650113f0ad1fd4448ce) > ["public_api"](#_c380937aaec0cc30e999a61e063f7cdbcee5f09b7e1252862cf45d59b8edc808)

# External module: "public_api"

## Index

---


<a name="_2d607afea4ba4c2a81cd8dc20cdc6f4753fba0ecb25cfea68fc5ff235a5b1e63"></a>
[@ibm-wch-sdk/log4js-logger](#_5e7167da50177490d07d2d9819695a358c9a90d385991650113f0ad1fd4448ce) > ["services/logger.factory"](#_2d607afea4ba4c2a81cd8dc20cdc6f4753fba0ecb25cfea68fc5ff235a5b1e63)

# External module: "services/logger.factory"

## Index

### Classes

* [Log4jsLoggerService](#_28b30fcb3c24af6f5e567877b2595f2b8a1ed9cfbce4837c49c0385a475d7bef)

---


<a name="_5e7167da50177490d07d2d9819695a358c9a90d385991650113f0ad1fd4448ce"></a>

#  @ibm-wch-sdk/log4js-logger

## Index

### External modules

* ["module"](#_6d90679a99ebdb130822c569554b3420ee4231cd958d1cf6efdd2942430420f1)
* ["public_api"](#_c380937aaec0cc30e999a61e063f7cdbcee5f09b7e1252862cf45d59b8edc808)
* ["services/logger.factory"](#_2d607afea4ba4c2a81cd8dc20cdc6f4753fba0ecb25cfea68fc5ff235a5b1e63)

---


<a name="_3bc0635281f3c8aa681ad71f9d5a4dcd5d5961c0fc8a0bf9057a71f8c345c31b"></a>
[@ibm-wch-sdk/log4js-logger](#_5e7167da50177490d07d2d9819695a358c9a90d385991650113f0ad1fd4448ce) > ["module"](#_6d90679a99ebdb130822c569554b3420ee4231cd958d1cf6efdd2942430420f1) > [WchLog4jsLoggingModule](#_3bc0635281f3c8aa681ad71f9d5a4dcd5d5961c0fc8a0bf9057a71f8c345c31b)

# Class: WchLog4jsLoggingModule

## Hierarchy

**WchLog4jsLoggingModule**

## Index

### Constructors

* [constructor](#_3bc0635281f3c8aa681ad71f9d5a4dcd5d5961c0fc8a0bf9057a71f8c345c31b)

### Methods

* [forRoot](#_3bc0635281f3c8aa681ad71f9d5a4dcd5d5961c0fc8a0bf9057a71f8c345c31b)

---

## Constructors

<a id="constructor"></a>

###  constructor

⊕ **new WchLog4jsLoggingModule**(parentModule: *[WchLog4jsLoggingModule](#_3bc0635281f3c8aa681ad71f9d5a4dcd5d5961c0fc8a0bf9057a71f8c345c31b)*): [WchLog4jsLoggingModule](#_3bc0635281f3c8aa681ad71f9d5a4dcd5d5961c0fc8a0bf9057a71f8c345c31b)

*Defined in module.ts:27*

**Parameters:**

| Name | Type |
| ------ | ------ |
| parentModule | [WchLog4jsLoggingModule](#_3bc0635281f3c8aa681ad71f9d5a4dcd5d5961c0fc8a0bf9057a71f8c345c31b) |

**Returns:** [WchLog4jsLoggingModule](#_3bc0635281f3c8aa681ad71f9d5a4dcd5d5961c0fc8a0bf9057a71f8c345c31b)

___

## Methods

<a id="forroot"></a>

### `<Static>` forRoot

▸ **forRoot**(): `ModuleWithProviders`

*Defined in module.ts:22*

**Returns:** `ModuleWithProviders`

___


<a name="_28b30fcb3c24af6f5e567877b2595f2b8a1ed9cfbce4837c49c0385a475d7bef"></a>
[@ibm-wch-sdk/log4js-logger](#_5e7167da50177490d07d2d9819695a358c9a90d385991650113f0ad1fd4448ce) > ["services/logger.factory"](#_2d607afea4ba4c2a81cd8dc20cdc6f4753fba0ecb25cfea68fc5ff235a5b1e63) > [Log4jsLoggerService](#_28b30fcb3c24af6f5e567877b2595f2b8a1ed9cfbce4837c49c0385a475d7bef)

# Class: Log4jsLoggerService

## Hierarchy

**Log4jsLoggerService**

## Implements

* `LoggerFactory`

## Index

### Constructors

* [constructor](#_28b30fcb3c24af6f5e567877b2595f2b8a1ed9cfbce4837c49c0385a475d7bef)

### Methods

* [create](#_28b30fcb3c24af6f5e567877b2595f2b8a1ed9cfbce4837c49c0385a475d7bef)

---

## Constructors

<a id="constructor"></a>

###  constructor

⊕ **new Log4jsLoggerService**(): [Log4jsLoggerService](#_28b30fcb3c24af6f5e567877b2595f2b8a1ed9cfbce4837c49c0385a475d7bef)

*Defined in services/logger.factory.ts:7*

**Returns:** [Log4jsLoggerService](#_28b30fcb3c24af6f5e567877b2595f2b8a1ed9cfbce4837c49c0385a475d7bef)

___

## Methods

<a id="create"></a>

###  create

▸ **create**(name: *`string`*): `Logger`

*Defined in services/logger.factory.ts:10*

**Parameters:**

| Name | Type |
| ------ | ------ |
| name | `string` |

**Returns:** `Logger`

___