# pino-trace-logger

> logger with id for each log

Latest version **1.0.4** (published 2021-06-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install pino-trace-logger
pnpm add pino-trace-logger
yarn add pino-trace-logger
bun add pino-trace-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.0.4 |
| Published | 2021-06-15 |
| First published | 2021-06-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | andreigolivets |
| Maintainers | andreigolivets |
| Keywords | pino, logger, trace-logger, logging |

## Links

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

## Dependencies (3)

- [pino](https://npm.io/package/pino.md) ^6.11.3
- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [pino-pretty](https://npm.io/package/pino-pretty.md) ^5.0.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

- 1.0.4 (latest) — 2021-06-15
- 1.0.3 — 2021-06-15
- 1.0.2 — 2021-06-15
- 1.0.1 — 2021-06-15

## README

# pino-trace-logger

Get logs with `traceId` for associate each.
Its useful for find unique user steps in logs
when you have many parallel requests in one time.

## Installation

```sh
$ npm install pino-trace-logger
```

## API

```js
const logger = require('pino-trace-logger');
```

### logger(function)

Create a new logger middleware function using
the given `function` for getting trace value,
by default trace value will be getting from `req.headers['x-request-id']`

## Example

```js
const express = require('express');
const logger = require('pino-trace-logger');
const app = express();

app.use(logger());

app.get('/', function (req, res) {
  logger.info('start processing');
  res.end();
  logger.info('finish processing');
});

app.listen(8080, () => {
    logger.info('app is started');
});
```

## Requirements

NodeJs version 12+

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