npm package: @ibm-wch-sdk/typescript-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/typescript-logger

## Index

### External modules

* ["index"](#_5ccd4d73cc1cdd2aa8f4e5f7a4737bc7f3fd50d7d5c26b8484e764b8b655f040)
* ["module"](#_6d90679a99ebdb130822c569554b3420ee4231cd958d1cf6efdd2942430420f1)
* ["services/logger.factory"](#_2d607afea4ba4c2a81cd8dc20cdc6f4753fba0ecb25cfea68fc5ff235a5b1e63)

---


<a name="_5ccd4d73cc1cdd2aa8f4e5f7a4737bc7f3fd50d7d5c26b8484e764b8b655f040"></a>
[@ibm-wch-sdk/typescript-logger](#_5e7167da50177490d07d2d9819695a358c9a90d385991650113f0ad1fd4448ce) > ["index"](#_5ccd4d73cc1cdd2aa8f4e5f7a4737bc7f3fd50d7d5c26b8484e764b8b655f040)

# External module: "index"

## Index

---


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

# External module: "module"

## Index

### Classes

* [WchTypescriptLoggingModule](#_c20ee63bb91c62c96976ce04a4a21c55c8a6003015d2387797c0780ec9a1db73)

---


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

# External module: "services/logger.factory"

## Index

### Classes

* [TypescriptLoggerService](#_11e3a482647e77a0d7613e47c47318da0674ec6a9ace2eeaec58065fca0385de)

---


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

#  @ibm-wch-sdk/typescript-logger

## Index

### External modules

* ["index"](#_5ccd4d73cc1cdd2aa8f4e5f7a4737bc7f3fd50d7d5c26b8484e764b8b655f040)
* ["module"](#_6d90679a99ebdb130822c569554b3420ee4231cd958d1cf6efdd2942430420f1)
* ["services/logger.factory"](#_2d607afea4ba4c2a81cd8dc20cdc6f4753fba0ecb25cfea68fc5ff235a5b1e63)

---


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

# Class: WchTypescriptLoggingModule

## Hierarchy

**WchTypescriptLoggingModule**

## Index

### Constructors

* [constructor](#_c20ee63bb91c62c96976ce04a4a21c55c8a6003015d2387797c0780ec9a1db73)

### Methods

* [forRoot](#_c20ee63bb91c62c96976ce04a4a21c55c8a6003015d2387797c0780ec9a1db73)

---

## Constructors

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

###  constructor

⊕ **new WchTypescriptLoggingModule**(parentModule: *[WchTypescriptLoggingModule](#_c20ee63bb91c62c96976ce04a4a21c55c8a6003015d2387797c0780ec9a1db73)*): [WchTypescriptLoggingModule](#_c20ee63bb91c62c96976ce04a4a21c55c8a6003015d2387797c0780ec9a1db73)

*Defined in module.ts:28*

**Parameters:**

| Name | Type |
| ------ | ------ |
| parentModule | [WchTypescriptLoggingModule](#_c20ee63bb91c62c96976ce04a4a21c55c8a6003015d2387797c0780ec9a1db73) |

**Returns:** [WchTypescriptLoggingModule](#_c20ee63bb91c62c96976ce04a4a21c55c8a6003015d2387797c0780ec9a1db73)

___

## Methods

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

### `<Static>` forRoot

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

*Defined in module.ts:21*

**Returns:** `ModuleWithProviders`

___


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

# Class: TypescriptLoggerService

## Hierarchy

**TypescriptLoggerService**

## Implements

* `LoggerFactory`

## Index

### Constructors

* [constructor](#_11e3a482647e77a0d7613e47c47318da0674ec6a9ace2eeaec58065fca0385de)

### Methods

* [create](#_11e3a482647e77a0d7613e47c47318da0674ec6a9ace2eeaec58065fca0385de)

---

## Constructors

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

###  constructor

⊕ **new TypescriptLoggerService**(): [TypescriptLoggerService](#_11e3a482647e77a0d7613e47c47318da0674ec6a9ace2eeaec58065fca0385de)

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

**Returns:** [TypescriptLoggerService](#_11e3a482647e77a0d7613e47c47318da0674ec6a9ace2eeaec58065fca0385de)

___

## Methods

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

###  create

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

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

**Parameters:**

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

**Returns:** `Logger`

___