open-index/open-npm huggingface dataset:
npm package: @lautmaler/jovo-plugin-turninfo
Description: extract some infos about the request just processed and log it as a json
Author: @lautmaler
Latest version: 0.5.0

# TurnInfoLogPlugin

The `TurnInfoLogPlugin` is a [`Jovo`](https://github.com/jovotech/jovo-framework) plugin that performs data aggregation of request and state data, e.g. `requestId`, `sessionData` and much more.

## Installation

Install the plugin in your Jovo project using `npm`:

```sh
$ npm install @lautmaler/jovo-plugin-turninfo
```

After successfully installing the plugin, you can add it to your app configuration:

```typescript
const app = new App({
  // ...
  plugins: [
    // ...
    new TurnInfoLogPlugin({
      // ...
    }),
  ],
});
```

The plugin accepts the following configuration:

```typescript
new TurnInfoLogPlugin({
  enabled: true,
  override(jovo: Jovo) {
    return {
      // ...
    };
  },
  skipTests: true,
});
```

- `enabled`: Whether to enable the plugin in the current context or not
- `override`: Function used to override properties or add new ones, e.g. platform-specific fields, see [overriding properties](#overriding-properties)
- `skipTests`: Whether to enable/disable this plugin when running unit tests

### Overriding properties

It is common to log platform-specific properties when working with the `TurnInfoLogPlugin`, since it only logs standard, globally accessible properties by default. To work around this, you can use the `override()` function in the configuration to override and add properties to your log. Simply return an object of key-value pairs, that will later on be merged with the default logging object.

```typescript
new TurnInfoLogPlugin({
  override(jovo: Jovo) {
    return {
      requestId: jovo.$request.id,
      intent: jovo.$input.nlu.intent,
      // ...
    }
  }
})
```

You can even type the parameter to match your platform, e.g. using `CorePlatform`:

```typescript
new TurnInfoLogPlugin({
  override(core: Core) {
    return {
      timeZone: core.$request.timeZone,
      // ...
    }
  }
})
```

Just keep in mind that if you're using multiple platforms, you'll have to disambiguate what platform you're using in your `override()` function.