open-index/open-npm huggingface dataset:
npm package: @pgprojectx/alchemy-koa-logging
Description: Provides a uniform logging middleware for [koa](http://koajs.com).  Built on [bunyan](https://github.com/trentm/node-bunyan).
Author: Steven White
Latest version: 1.1.0

# alchemy-koa-logging

Provides a uniform logging middleware for [koa](http://koajs.com).  Built on [bunyan](https://github.com/trentm/node-bunyan).

## Installation

```
yarn add @pgprojectx/alchemy-koa-logging
```

or

```
npm install --save @pgprojectx/alchemy-koa-logging
```

## Usage

alchemy-koa-logging requires a base bunyan instance to be provided.

Simple usage:

```javascript
const Koa = require('koa');
const koaLogger = require('@pgprojectx/alchemy-koa-logging');
const bunyan = require('bunyan');

const logger = bunyan.createLogger({ name: 'my-service' });
const app = new Koa();
app.use(koaLogger(logger));
```


This will accomplish a few things:

* A child logger will be created for each request and attached to `ctx` at `ctx.logger`.
* Each request generates a unique identifier to trace.  This is automatically attached to the child logger and available at `ctx.state.request_id`.
* An access logger will log all requests with standard output.

Example output:

![](https://cldup.com/F5wdhY3I0G.png)
npm package: @pgprojectx/bazaarvoice-sdk
Description: API wrapper for BazaarVoice
Author: Jeremiah Harlan
Latest version: 1.0.0

# @pgprojectx/bazaarvoice-sdk

> API wrapper for BazaarVoice

## Table of Contents

- [Install](#install)
- [Usage](#usage)
- [Notes](#notes)

## Install

```
# For JavaScript usage
npm install --save-exact @pgprojectx/bazaarvoice-sdk

# For CLI usage
npm install --global @pgprojectx/bazaarvoice-sdk
```

## Usage

```javascript
const bazaarvoice = require('@pgprojectx/bazaarvoice-sdk');

const client = bazaarvoice({
  host: 'https://api.bazaarvoice.com',
  apiVersion: '5.4',
  apiKey: 'apiKey'
});

// Get Product Reviews
const reviews = await client.getProductReviews('000123645678901');
console.log(reviews);
// {
//   "reviewCount": Number,
//   "reviews": Array,
//   "rating": Number
// }
```

### Configuration Files

Create [an rc file][rc] to set defaults, so you don't have to pass a
`host`, `apiKey`, and `apiVersion` flag to every command.

```
# ~/.bazaarvoicerc
host = https://api.bazaarvoice.com
apiKey = your-api-key
apiVersion = 5.4
```

`@pgprojectx/bazaarvoice-sdk` will walk the directory tree looking for rc files, so you can create
one in the root of your project's directory to make the CLI
context aware.

### Commands

#### Get Product Reviews

Retrieve product review information for a specified product. The results are written to `stdout`

```
> bazaarvoice-sdk get-product-reviews -h
bazaarvoice-sdk get-product-reviews [productId]

Get product reviews for a product ID

Options:
  --version          Show version number                               [boolean]
  --host, --apiHost  BazaarVoice API hostname                         [required]
  --apiKey           API key for BazaarVoice                          [required]
  --apiVersion       BazaarVoice API version                          [required]
  --productId        Product ID
  --raw              Return full response data
  -h                 Show help                                         [boolean]
```

## Notes

BazaarVoice does not return 404s for non-existing products. So default responses will result in the following object

```json
{
  "reviewCount": 0,
  "reviews": [],
  "rating": false
}
```

[rc]: https://www.npmjs.com/package/rc