# fetchware-console

> Minimalistic fetch decorator for console logging

Latest version **1.0.3** (published 2017-03-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install fetchware-console
pnpm add fetchware-console
yarn add fetchware-console
bun add fetchware-console
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2017-03-26 |
| First published | 2017-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ct0r |
| Maintainers | ct0r |
| Keywords | fetch, decorator, wrapper, console, logger, fetchware |

## Links

- npm: https://www.npmjs.com/package/fetchware-console
- Repository: https://github.com/ct0r/fetchware-console
- Homepage: https://github.com/ct0r/fetchware-console#readme
- Issues: https://github.com/ct0r/fetchware-console/issues
- npm.io page: https://npm.io/package/fetchware-console

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2017-03-26
- 1.0.2 — 2017-03-26
- 1.0.1 — 2017-03-24
- 0.1.0 — 2017-03-09

## README

# fetchware-console
[![npm version][npm-img]][npm-url]
[![build status][build-img]][build-url]
[![coverage status][coverage-img]][coverage-url]
[![dependencies][dependencies-img]][dependencies-url]

Log all fetch api calls to console without changes to api

## Installation
```sh
npm install --save fetchware-console
```

## Usage
Basic usage with default formatting `status method url delay(ms)`

```js
const consoleLogger = require('fetchware-console')
const isomorphicFetch = require('isomorphic-fetch') //or use your favorite fetch implementation

const fetch = consoleLogger()(isomorphicFetch)
```

Custom format

```js
const options = {
  format: (date, url, options, response, ms) => console.log()
}

const fetch = consoleLogger(options)(isomorphicFetch)
```

## Custom parameters
Decorator passes all arguments to decorated function. Useful for decorator interaction.

```js
const consoleLogger = require('fetchware-console')
const isomorphicFetch = require('isomorphic-fetch') //or use your favorite fetch implementation

const myFetchDecorator = fetch =>
  (url, options, {log}) => {
    if (log)
      console.log(url)

    return fetch(url, options)
  }

let fetch = myFetchDecorator(isomorphicFetch)
fetch = consoleLogger()(fetch)

fetch('http://github.com', {method: 'POST'}, {log: true})
```

## Licence
MIT

[npm-img]: https://badge.fury.io/js/fetchware-console.svg
[npm-url]: https://www.npmjs.com/package/fetchware-console
[build-img]: https://circleci.com/gh/ct0r/fetchware-console.png?style=shield
[build-url]: https://circleci.com/gh/ct0r/fetchware-console
[coverage-img]: https://coveralls.io/repos/github/ct0r/fetchware-console/badge.svg?branch=master
[coverage-url]: https://coveralls.io/github/ct0r/fetchware-console?branch=master
[dependencies-img]: https://david-dm.org/ct0r/fetchware-console.svg
[dependencies-url]: https://david-dm.org/ct0r/fetchware-console

---
_Source: https://npm.io/package/fetchware-console · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
