diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index af61feb3d6..59f0f70e56 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -444,6 +444,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](log4javascript/log4javascript.d.ts) [log4javascript](http://log4javascript.org) by [Markus Wagner](https://github.com/Ritzlgrmft) * [:link:](log4js/log4js.d.ts) [log4js](https://github.com/nomiddlename/log4js-node) by [Kentaro Okuno](http://github.com/armorik83) * [:link:](logg/logg.d.ts) [logg](https://github.com/dpup/node-logg) by [Bret Little](https://github.com/blittle) +* [:link:](logrotate-stream/logrotate-stream.d.ts) [logrotate-stream](https://github.com/dstokes/logrotate-stream) by [rogierschouten](https://github.com/rogierschouten) * [:link:](long/long.d.ts) [Long.js](https://github.com/dcodeIO/Long.js) by [Toshihide Hara](https://github.com/kerug) * [: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) * [:link:](lscache/lscache.d.ts) [lscache](https://github.com/pamelafox/lscache) by [Chris Martinez](https://github.com/Chris-Martinezz) diff --git a/logrotate-stream/logrotate-stream-tests.ts b/logrotate-stream/logrotate-stream-tests.ts new file mode 100644 index 0000000000..c7d4ed8091 --- /dev/null +++ b/logrotate-stream/logrotate-stream-tests.ts @@ -0,0 +1,10 @@ +/// + +import stream = require("stream"); +import rotateStream = require("logrotate-stream"); + +var s: stream.Writable = rotateStream({ + file: "mylogfile.log", + size: "1m", + keep: 3 +}); diff --git a/logrotate-stream/logrotate-stream.d.ts b/logrotate-stream/logrotate-stream.d.ts new file mode 100644 index 0000000000..97a290fdbe --- /dev/null +++ b/logrotate-stream/logrotate-stream.d.ts @@ -0,0 +1,46 @@ +// Type definitions for logrotate-stream 0.2.5 +// Project: https://github.com/dstokes/logrotate-stream +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +declare module "logrotate-stream" { + import stream = require("stream"); + + // wrapper to be able to use "export =" while also exporting the Options interface + module logrotateStream { + + /** + * Options object for the exported function. + */ + export interface Options { + /** + * The file log file to write data to. + */ + file: string; + /** + * The max file size of a log before rotation occurs. Supports 1024, 1k, 1m, 1g + */ + size: string; + /** + * The number of rotated log files to keep (including the primary log file). Additional logs are deleted no rotation. + */ + keep: number; + /** + * Optionally compress rotated files with gzip. + */ + compress?: boolean; + } + + } + + /** + * Create a rotating log stream. + * @returns a writable stream to a rotating log file + */ + function logrotateStream(opts: logrotateStream.Options): stream.Writable; + + + export = logrotateStream; +} +