# restify-logger

> A custom logger for restify

Latest version **2.0.1** (published 2014-10-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install restify-logger
pnpm add restify-logger
yarn add restify-logger
bun add restify-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 | 2.0.1 |
| Published | 2014-10-03 |
| First published | 2014-10-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Quentin Buathier |
| Maintainers | quentin01, matthieu.bacconnier, saveman71 |
| Keywords | restify, logger, morgan |

## Links

- npm: https://www.npmjs.com/package/restify-logger
- Repository: https://github.com/AnyFetch/restify-logger
- Issues: https://github.com/AnyFetch/restify-logger/issues
- npm.io page: https://npm.io/package/restify-logger

## Dependencies (1)

- [morgan](https://npm.io/package/morgan.md) ^1.3.2

## 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

- 2.0.1 (latest) — 2014-10-03
- 1.0.0 — 2014-10-02

## README

# Restify logger
> Visit http://anyfetch.com for details about AnyFetch.

Customizable logger for Restify based on [mogan](https://github.com/expressjs/morgan).

# Usage

```js
var logger = require('restify-logger');

// You can use the skip parameter to skip some requests
app.use(logger('custom', {
  skip: function (req) {
    return process.env.NODE_ENV === "test" || req.method === "OPTIONS" || req.url === "/status";
  }
}));
```

This will display:
```
DELETE ???:/user/542d5154d0db17c03ecd1499 25ms 204
```

## Overriding tokens
You can specify a function to be used by the `user` token:
```js
// Overwrite the default user function, that only writes '???:'
logger.token('user', function(req) {
  return (req.user && req.user.email || '???') + ':';
});
```

This will display:
```
DELETE test@anyfetch.com:/user/542d5154d0db17c03ecd1499 25ms 204
```

## Overriding formats
```js
var logger = require('restify-logger');

// morgan syntax
logger.format('my-simple-format', ':method :url :status')
app.use(logger('my-simple-format'));
```

This will display:
```
DELETE /user/542d5154d0db17c03ecd1499 204
```


Support: `support@anyfetch.com`.

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