Skip to content

Commit 9109a75

Browse files
committed
Merge pull request DefinitelyTyped#3716 from rogierschouten/logrotate-stream
Add typings for logrotate-stream
2 parents 0d7a9a4 + 68e963e commit 9109a75

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
444444
* [:link:](log4javascript/log4javascript.d.ts) [log4javascript](http://log4javascript.org) by [Markus Wagner](https://github.com/Ritzlgrmft)
445445
* [:link:](log4js/log4js.d.ts) [log4js](https://github.com/nomiddlename/log4js-node) by [Kentaro Okuno](http://github.com/armorik83)
446446
* [:link:](logg/logg.d.ts) [logg](https://github.com/dpup/node-logg) by [Bret Little](https://github.com/blittle)
447+
* [:link:](logrotate-stream/logrotate-stream.d.ts) [logrotate-stream](https://github.com/dstokes/logrotate-stream) by [rogierschouten](https://github.com/rogierschouten)
447448
* [:link:](long/long.d.ts) [Long.js](https://github.com/dcodeIO/Long.js) by [Toshihide Hara](https://github.com/kerug)
448449
* [:link:](lru-cache/lru-cache.d.ts) [lru-cache](https://github.com/isaacs/node-lru-cache) by [Bart van der Schoor](https://github.com/Bartvds)
449450
* [:link:](lscache/lscache.d.ts) [lscache](https://github.com/pamelafox/lscache) by [Chris Martinez](https://github.com/Chris-Martinezz)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference path="logrotate-stream.d.ts" />
2+
3+
import stream = require("stream");
4+
import rotateStream = require("logrotate-stream");
5+
6+
var s: stream.Writable = rotateStream({
7+
file: "mylogfile.log",
8+
size: "1m",
9+
keep: 3
10+
});
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Type definitions for logrotate-stream 0.2.5
2+
// Project: https://github.com/dstokes/logrotate-stream
3+
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
/// <reference path="../node/node.d.ts" />
7+
declare module "logrotate-stream" {
8+
import stream = require("stream");
9+
10+
// wrapper to be able to use "export =" while also exporting the Options interface
11+
module logrotateStream {
12+
13+
/**
14+
* Options object for the exported function.
15+
*/
16+
export interface Options {
17+
/**
18+
* The file log file to write data to.
19+
*/
20+
file: string;
21+
/**
22+
* The max file size of a log before rotation occurs. Supports 1024, 1k, 1m, 1g
23+
*/
24+
size: string;
25+
/**
26+
* The number of rotated log files to keep (including the primary log file). Additional logs are deleted no rotation.
27+
*/
28+
keep: number;
29+
/**
30+
* Optionally compress rotated files with gzip.
31+
*/
32+
compress?: boolean;
33+
}
34+
35+
}
36+
37+
/**
38+
* Create a rotating log stream.
39+
* @returns a writable stream to a rotating log file
40+
*/
41+
function logrotateStream(opts: logrotateStream.Options): stream.Writable;
42+
43+
44+
export = logrotateStream;
45+
}
46+

0 commit comments

Comments
 (0)