# superagent-logger

> superagent middleware for adding NPM-style logging. Useful for debugging HTTP clients.

Latest version **1.1.0** (published 2016-01-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install superagent-logger
pnpm add superagent-logger
yarn add superagent-logger
bun add superagent-logger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2016-01-22 |
| First published | 2015-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Pedro Tacla Yamada |
| Maintainers | yamadapc |
| Keywords | superagent, npm, logger, debugging, debug, logs, request, http |

## Links

- npm: https://www.npmjs.com/package/superagent-logger
- Repository: https://github.com/yamadapc/superagent-logger
- Homepage: https://github.com/yamadapc/superagent-logger#readme
- Issues: https://github.com/yamadapc/superagent-logger/issues
- npm.io page: https://npm.io/package/superagent-logger

## Dependencies (1)

- [chalk](https://npm.io/package/chalk.md) ^1.1.0

## 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.1.0 (latest) — 2016-01-22
- 1.0.3 — 2015-07-03
- 1.0.2 — 2015-07-03
- 1.0.1 — 2015-07-03
- 1.0.0 — 2015-07-03

## README

superagent-logger
=================
[![npm downloads](http://img.shields.io/npm/dm/superagent-logger.svg)](https://www.npmjs.org/package/superagent-logger)
[![npm version](http://img.shields.io/npm/v/superagent-logger.svg)](https://www.npmjs.org/package/superagent-logger)
- - -
superagent middleware for adding NPM-style logging. Useful for debugging
HTTP clients.

## Installing
This package is published to NPM as `superagent-logger`.
```
npm install superagent-logger
```

## Usage
```javascript
var request = require('superagent');
var logger = require('superagent-logger');

request.get('https://github.com/').use(logger).query({ q: 'search' }).end();
request.post('https://github.com/').use(logger).end();
```
This will produce the following output:

![screeshot1](/screenshot1.png)

## Options

### Outgoing

If you want to log requests when they're fired, use the `outgoing` option:
```javascript
// Will log when the request is triggered:
request.get('https://github.com/').use(logger({ outgoing: true })).end();
```

![screeshot2](/screenshot2.png)

### Timestamp

To log a request timestamp with each log entry, use the `timestamp` option:
```javascript
// Will log when the request is triggered:
request.get('https://github.com/').use(logger({ timestamp: true })).end();
```

```
HTTPS GET   [2015-12-03T18:09:19.476Z] 200 https://github.com/ (9219ms)
```

## License
This code is licensed under the MIT license for Pedro Tacla Yamada.

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