visionmedia/log.js — pull request #11 by thakkar-rushikesh (2012-03-07 13:44:55+00:00)
Title: Adding Log Rotation based on 'maximum lines to write before rotating' philosophy

Adding log-rotation feature, based on maximum number of lines to be written before rotating the logs.

**Change details**:
Added 1 more argument: `rotateLimit` - the maximum number of lines to write before rotating
Emitting event `rotate` when this limit is crossed

**Philosophy**:
It may sound a bit strange to rotate logs in this way, but here is why I chose this way of rotating logs:
1. I didn't want the existing projects to be disturbed because of this change
2. I also didn't want to make it Mandatory for the users to rotate logs, thus only emitting an event just for notification
3. There was limited support from Node.js APIs for FileSystem & Writable Stream to implement log rotation by log-file's size.
4. Date based rotation could be implemented by TImer API, but I found it a bit too expensive for logging operation. One can anyway implement it without modifying the log API itself.

**Example**: `https://gist.github.com/1992459`