Socket
Socket
Sign inDemoInstall

bunyan-rotating-file-stream

Package Overview
Dependencies
4
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.2 to 2.0.3

.markdownlint.json

1

lib/periodtrigger.js

@@ -5,3 +5,2 @@ // Just emits "rotate" events at the right time.

var assert = require('assert');
var EventEmitter = require('events').EventEmitter;

@@ -8,0 +7,0 @@ var _ = require('lodash');

@@ -39,3 +39,3 @@ 'use strict';

// If teimer period is > ~25 days, we have to break into multiple
// If timer period is > ~25 days, we have to break into multiple
// setTimeout's. See <https://github.com/joyent/node/issues/8656>.

@@ -42,0 +42,0 @@ if (triggerTime && triggerTime > Date.now()) {

{
"name": "bunyan-rotating-file-stream",
"version": "2.0.2",
"version": "2.0.3",
"description": "a rotating file stream for the bunyan logging system",

@@ -5,0 +5,0 @@ "author": "Jim Tupper <npm@tupper.org.uk> (http://github.com/rcomian)",

@@ -0,1 +1,3 @@

# Bunyan Rotating File Stream
Bunyan Rotating File Stream is a stream component for the logging system "node bunyan" that provides rich and flexible control over your log files.

@@ -22,5 +24,5 @@

# Recent changes
## Recent changes
## 2.0.0 Version refresh
### 2.0.0 Version refresh

@@ -30,7 +32,7 @@ Updated dependencies and engine support (now v14+). This will allow me to refactor using the latest javascript syntax.

## 1.6.3 Type definition file for Typescript
### 1.6.3 Type definition file for Typescript
Generously provided by: scippio
## 1.6.2 Fixed support for the "rotateExisting" flag
### 1.6.2 Fixed support for the "rotateExisting" flag

@@ -40,7 +42,7 @@ Tests have been added to ensure that this feature keeps working in the future.

## 1.6 Support for non-JSON logs
### 1.6 Support for non-JSON logs
Minor release but now that logs which are written in a non-json format are supported.
## 1.5 Templates Release
### 1.5 Templates Release

@@ -52,5 +54,4 @@ We now have the ability to specify templates in the log's filename. For full details see the templating section, but briefly: we can template where you put the number when rotating files (this allows you to preserve the extension so that the files open in the correct viewer), or give your log filename a timestamp in your preferred format.

## Compatibility
# Compatibility
Implemented tests and strategies to support specific node versions:

@@ -63,17 +64,16 @@

*0.10 and earlier*
### 0.10 and earlier
Not supported as it is missing a lot of useful path processing features. Whilst we could patch this with inline code and npm packages, I think it's a shame to have these hanging around when the functionality will be built into all future versions of node.
*0.12*
### 0.12
Is supported, but it's performance cannot keep up with the latest versions of node. I've had to reduce the stress involved when running tests to allow old `0.12` to keep up.
*5*
### 5
Is supported, but won't be stress tested as those resources are being used for the LTS releases 0.12, 4 & 6.
## Current Status
# Current Status
The basics of the features are there, you should be able to use the

@@ -87,5 +87,4 @@ rotating file logging to limit disk space usage while maximising

## Planned Future Features
# Planned Future Features
* Prevent multiple processes logging to the same file

@@ -95,3 +94,3 @@ * Allow multiple processes to safely log to the same file

# Installation
## Installation

@@ -102,13 +101,12 @@ ```sh

# Main Features
## Main Features
- Name log files with templates
- Rotate to a new log file periodically (can also rotate on startup to clean old log files)
- Rotate to a new log file once the main log file goes over a certain size
- Keep a maximum number of archival log files
- Delete older log files once the archive reaches a certain size
- GZip archived log files
- Supports being a raw stream or a normal stream
* Name log files with templates
* Rotate to a new log file periodically (can also rotate on startup to clean old log files)
* Rotate to a new log file once the main log file goes over a certain size
* Keep a maximum number of archival log files
* Delete older log files once the archive reaches a certain size
* GZip archived log files
* Supports being a raw stream or a normal stream
## How to use

@@ -236,3 +234,3 @@

<td></td>
<td><p>An array of string that specify the order the log parameters are written to the file.</p>
<td><p>An array of strings that specify the order the log parameters are written to the file.</p>

@@ -263,3 +261,3 @@ <p>This option allows certain keys in the log fields to be written first for each log entry in the file.

## rotateExisting and Linux filesystems (EXT4) support
### rotateExisting and Linux filesystems (EXT4) support

@@ -278,5 +276,5 @@ Some filesystems on Linux (in particular EXT4) do not record the file creation date.

# Templating
## Templating
## Behaviour without templating
### Behaviour without templating

@@ -287,3 +285,3 @@ By default, if you just give a normal filename for your log, it will be rotated by appending a number to the end of the file.

```
```text
webapi.log // log file having logs written to it.

@@ -294,3 +292,3 @@ ```

```
```text
webapi.log // new log file, logs will be written here.

@@ -302,3 +300,3 @@ webapi.log.1 // old log file, for archival only.

```
```text
webapi.log // new log file, logs will be written here.

@@ -311,3 +309,3 @@ webapi.log.1 // archive of the previously active log file.

## Rotation number templating [%N]
### Rotation number templating [%N]

@@ -318,3 +316,3 @@ We can tell the system where to insert the rotation number in the filename. To do this, use the `%N` template parameter (uppercase N). This parameter can only appear in the filename, not in the directories or the extension.

```
```text
webapi.log // the log file receiving new logs.

@@ -329,3 +327,3 @@ webapi.1.log // archive of the previously active log file.

## Datetime templating [%Y %m %d %H %M %S]
### Datetime templating [%Y %m %d %H %M %S]

@@ -341,3 +339,3 @@ We can also insert the current time into the log file name. This is the time that the log file was created and should contain logs from that time onwards (notice: this is a hint, not a guarantee: there may be some stragglers from the previous file).

```
```text
webapi.28-Feb-16.log // Oldest file containing the oldest logs

@@ -348,7 +346,7 @@ webapi.29-Feb-16.log

### Filename clashes
#### Filename clashes
The file stream makes no requirement that your filename be particularly unique or sort sensibly in any way. If in the previous example, we rotated twice on the same day, we'd differentiate the files by adding a number like this:
```
```text
webapi.28-Feb-16.log // Original file containing the oldest logs

@@ -361,3 +359,3 @@ webapi.28-Feb-16.1.log

### Deleting old files
#### Deleting old files

@@ -373,10 +371,10 @@ When deleting files based on how many archive files we want to keep, or how much space we want to give to log archives, we delete the oldest files based on the modified time of that file.

# Creating new files on startup
## Creating new files on startup
When we startup we look for any existing log files to append to. If we find a viable file, we simply open it and start appending logs to it. This is the behaviour for all files, whether templated or not.
## Rotating old files [{rotateExisting: true}]
### Rotating old files [{rotateExisting: true}]
If an old file should have been rotated but your process wasn't running at the time (maybe you choose to have a new file every day, but the process wasn't running at midnight), we will still append to it. Force a rotation on old files using the option: `{rotateExisting: true}`. This will only rotate files that would have been rotated had we stayed running. This option works for templated or non-templated files.
**Note 1: Timestamp in filename**: If your log files have a timestamp in the filename, the timestamp will match when the file would have last rotated, not the current time.

@@ -386,9 +384,9 @@

## Force new files [{startNewFile: true}]
### Force new files [{startNewFile: true}]
Instead of appending logs to an existing file, you can force a new file to be created using the option: `{startNewFile: true}`.
If the file date stamp clashes with an existing file, the dotted number notation will be used as normal.
## Versioning
# Versioning
The scheme I follow is most succinctly described by the bootstrap guys

@@ -401,8 +399,8 @@ [here](https://github.com/twitter/bootstrap#versioning).

# License
## License
MIT. See "LICENSE.txt".
# See Also
## See Also
- Bunyan: <https://github.com/trentm/node-bunyan>.
* Bunyan: <https://github.com/trentm/node-bunyan>.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc