Write log files and rotate them using gzip.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jose Quintana 6fd9b2344e 1.0.0-rc1 1 month ago
.vscode ts version 1 month ago
sample chore: clean up dir 1 month ago
src feat: prefer UTC dates 1 month ago
.dockerignore init 1 month ago
.gitignore ts version 1 month ago
.travis.yml feat: add travis support 1 month ago
Dockerfile init 1 month ago
LICENSE-APACHE ts version 1 month ago
LICENSE-MIT ts version 1 month ago
README.md chore: add comment log file example 1 month ago
docker-compose.yml ts version 1 month ago
package.json 1.0.0-rc1 1 month ago
tsconfig.json ts version 1 month ago
tslint.json ts version 1 month ago
yarn.lock ts version 1 month ago



Build Status npm npm JavaScript Style Guide

Write log files and rotate them using gzip.


  • Output logs to time-rotated log files.
  • Optionally gzip logs once they are no longer current.
  • Dates are expressed in UTC only.
  • Stream pipe functionality coming soon.



yarn add logger-stream-rotate --dev


npm install logger-stream-rotate --save-dev


import { Logger } from "logger-stream-rotate"

// Logger supports log a file name format like "YYYY-MM-DD hh:mm:ss" with an optional separator
const logger = Logger("./app-%YYYY-%MM-%DD.log", " | ")

    // string or array of strings are supported which will be concatenated by ` | ` in one line
    ["Log entry part 1", "another log entry part 2", "etc..."],
    () => console.log("callback when current log entry was finished!")

// Log file content: `app-2019-09-17.log`
// 2019-10-17T07:47:35.096Z | 1571298455096 | Log entry part 1 | another log entry part 2 | etc...

An example file is located at sample/sample.ts


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.

Feel free to send some Pull request or issue.


This work is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

© 2019 Jose Quintana