# bunyan-rotate-file-stream

> log bunyan rotate file stream

Latest version **1.1.9** (published 2017-06-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install bunyan-rotate-file-stream
pnpm add bunyan-rotate-file-stream
yarn add bunyan-rotate-file-stream
bun add bunyan-rotate-file-stream
```

## 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.9 |
| Published | 2017-06-29 |
| First published | 2017-06-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | 39Er |
| Maintainers | 39er |
| Keywords | log, bunyan, stream |

## Links

- npm: https://www.npmjs.com/package/bunyan-rotate-file-stream
- Repository: https://github.com/39Er/bunyan-rotate-file-stream
- Homepage: https://github.com/39Er/bunyan-rotate-file#readme
- Issues: https://github.com/39Er/bunyan-rotate-file/issues
- npm.io page: https://npm.io/package/bunyan-rotate-file-stream

## Dependencies (2)

- [bunyan](https://npm.io/package/bunyan.md) ^1.8.10
- [moment](https://npm.io/package/moment.md) ^2.18.1

## 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.9 (latest) — 2017-06-29
- 1.1.8 — 2017-06-29
- 1.1.7 — 2017-06-20
- 1.1.6 — 2017-06-20
- 1.1.5 — 2017-06-20
- 1.1.4 — 2017-06-16
- 1.1.3 — 2017-06-12
- 1.1.2 — 2017-06-12
- 1.1.1 — 2017-06-07
- 1.1.0 — 2017-06-07
- 1.0.0 — 2017-06-07

## README

# bunyan-rotate-file-stream

> **A stream for bunyan to output log to file,every day create a new file**

## Installation

	npm install bunyan-rotate-file-stream

**Constructor**: **new RotateFileStream(logpath,maxSize)**

- logPath<String\>: the logfile where logs are stored into,required
- maxSize <Int\>: the max number of the log files in the log directory,optional

Example:

	let logger = bunyan.createLogger({
	  name: 'bunyan-rotate',
	  serializers: bunyan.stdSerializers,
	  src: false,
	  streams: [
	    {
	      level: 'error',
	      type: 'raw',
	      stream: new RotateFileStream('./logs/error.log')),
	    }
	  ],
	});
	logger.error('test bunyan logger');

In your directory,it will make a file named 'error.log'. On the secode day,it will rename the file like 'error.log.20170607',and make a new file named 'error.log' to store new logs of the secode day.

You can also add other streams ,like:

	let logger = bunyan.createLogger({
	  name: 'bunyan-rotate',
	  serializers: bunyan.stdSerializers,
	  src: false,
	  streams: [
	    {
	      level: 'error',
	      type: 'raw',
	      stream: new RotateFileStream(path.join('./logs/error.log')),
	    }, {
	      level: 'info',
	      stream: process.stdout,
	    },
	  ],
	});
	logger.info('test bunyan info');
	logger.error('test bunyan logger');

Output:

	[2017-06-07T08:21:10.965Z]  INFO: bunyan-rotate/13896 on CNBJHQTEC111: test bunyan info
	[2017-06-07T08:21:10.967Z] ERROR: bunyan-rotate/13896 on CNBJHQTEC111: test bunyan error

File '/logs/error.log':

	{"name":"bunyan-rotate","hostname":"CNBJHQTEC111","pid":13896,"level":50,"msg":"test bunyan error","time":"2017-06-07T08:21:10.967Z","v":0}

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