# winston-circular-buffer

> An in-memory circular buffer logging transport for winston.js

Latest version **1.0.0** (published 2015-12-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install winston-circular-buffer
pnpm add winston-circular-buffer
yarn add winston-circular-buffer
bun add winston-circular-buffer
```

## 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.0 |
| Published | 2015-12-13 |
| First published | 2015-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Jonathan Perkins |
| Maintainers | jonathanperkins |
| Keywords | winston, circular-buffer |

## Links

- npm: https://www.npmjs.com/package/winston-circular-buffer
- Repository: https://github.com/JonathanPerkins/winston-circular-buffer
- Issues: https://github.com/JonathanPerkins/winston-circular-buffer/issues
- npm.io page: https://npm.io/package/winston-circular-buffer

## Dependencies (1)

- [circular-buffer](https://npm.io/package/circular-buffer.md) 0.0.6

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-12-13

## README

# Winston Circular buffer

An in-memory circular buffer logging transport for the [winston.js](https://github.com/winstonjs/winston) node.js logging system.

This transport allows a simple most-recent view of log entries from a bounded
circular buffer. Useful if you just want to see whats recently happened without
having to manage growing memory usage, file rotation etc.

## Usage

Specify the size of the buffer when adding the transport:

```javascript
var winston = require('winston');
var cbuff   = require('winston-circular-buffer');

var logger = new (winston.Logger)({
    transports: [
        new (winston.transports.Console)(),
        new (winston.transports.CircularBuffer)({
            name: 'circular-buffer',
            level: 'info',
            json: true,
            size: 50
        })
    ]
});
```

Log as usual, and query the buffer:

```javascript
logger.warn('my warning', { meta: 21 });

var options = {
    json: true,
    order: 'asc'
};

logger.query(options, function(err, results) {
    // Check err, handle results array

});
```

The query options are:
* `json:` set to `true` (default) if you want the records to be json objects, `false` for strings (note that if the transport has been configured for `json: false` then you will always get strings returned).
* `order:` set to `'desc'` (default) to produce descending order results (most recent first). Use `order: 'asc'` for ascending output.


## Install

```bash
npm install
```

## Test

```bash
npm test
```

## Author

(c) Jonathan Perkins 2015.

Feedback, bug reports welcome via https://github.com/JonathanPerkins/winston-circular-buffer

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