changelog for recent stuff; 'DEBUG' was a dumb name for this internal var

This commit is contained in:
Trent Mick 2013-01-29 00:00:04 -08:00
parent 473736b9e0
commit 573c33ab99
2 changed files with 13 additions and 11 deletions

View file

@ -8,7 +8,9 @@ Known issues:
## bunyan 0.18.2 (not yet released) ## bunyan 0.18.2 (not yet released)
(nothing yet) - [pull #67] Remove debugging prints in rotating-file support.
(by github.com/chad3814).
- Update to dtrace-provider@0.2.7.
## bunyan 0.18.1 ## bunyan 0.18.1

View file

@ -992,12 +992,12 @@ RotatingFileStream.prototype._setupNextRot = function () {
} }
RotatingFileStream.prototype._nextRotTime = function _nextRotTime(first) { RotatingFileStream.prototype._nextRotTime = function _nextRotTime(first) {
var DEBUG = false; var _DEBUG = false;
if (DEBUG) console.log('-- _nextRotTime: %s%s', this.periodNum, this.periodScope); if (_DEBUG) console.log('-- _nextRotTime: %s%s', this.periodNum, this.periodScope);
var d = new Date(); var d = new Date();
if (DEBUG) console.log(' now local: %s', d); if (_DEBUG) console.log(' now local: %s', d);
if (DEBUG) console.log(' now utc: %s', d.toISOString()); if (_DEBUG) console.log(' now utc: %s', d.toISOString());
var rotAt; var rotAt;
switch (this.periodScope) { switch (this.periodScope) {
case 'ms': case 'ms':
@ -1055,7 +1055,7 @@ RotatingFileStream.prototype._nextRotTime = function _nextRotTime(first) {
assert.fail(format('invalid period scope: "%s"', this.periodScope)); assert.fail(format('invalid period scope: "%s"', this.periodScope));
} }
if (DEBUG) { if (_DEBUG) {
console.log(' **rotAt**: %s (utc: %s)', rotAt, console.log(' **rotAt**: %s (utc: %s)', rotAt,
new Date(rotAt).toUTCString()); new Date(rotAt).toUTCString());
var now = Date.now(); var now = Date.now();
@ -1071,9 +1071,9 @@ RotatingFileStream.prototype._nextRotTime = function _nextRotTime(first) {
RotatingFileStream.prototype.rotate = function rotate() { RotatingFileStream.prototype.rotate = function rotate() {
// XXX What about shutdown? // XXX What about shutdown?
var self = this; var self = this;
var DEBUG = false; var _DEBUG = false;
if (DEBUG) console.log('-- [%s] rotating %s', new Date(), self.path); if (_DEBUG) console.log('-- [%s] rotating %s', new Date(), self.path);
if (self.rotating) { if (self.rotating) {
throw new TypeError('cannot start a rotation when already rotating'); throw new TypeError('cannot start a rotation when already rotating');
} }
@ -1087,7 +1087,7 @@ RotatingFileStream.prototype.rotate = function rotate() {
toDel = self.path; toDel = self.path;
} }
n -= 1; n -= 1;
if (DEBUG) console.log('rm %s', toDel); if (_DEBUG) console.log('rm %s', toDel);
fs.unlink(toDel, function (delErr) { fs.unlink(toDel, function (delErr) {
//XXX handle err other than not exists //XXX handle err other than not exists
moves(); moves();
@ -1108,7 +1108,7 @@ RotatingFileStream.prototype.rotate = function rotate() {
if (!exists) { if (!exists) {
moves(); moves();
} else { } else {
if (DEBUG) console.log('mv %s %s', before, after); if (_DEBUG) console.log('mv %s %s', before, after);
mv(before, after, function (mvErr) { mv(before, after, function (mvErr) {
if (mvErr) { if (mvErr) {
self.emit('error', mvErr); self.emit('error', mvErr);
@ -1122,7 +1122,7 @@ RotatingFileStream.prototype.rotate = function rotate() {
} }
function finish() { function finish() {
if (DEBUG) console.log('open %s', self.path); if (_DEBUG) console.log('open %s', self.path);
self.stream = fs.createWriteStream(self.path, self.stream = fs.createWriteStream(self.path,
{flags: 'a', encoding: 'utf8'}); {flags: 'a', encoding: 'utf8'});
var q = self.rotQueue, len = q.length; var q = self.rotQueue, len = q.length;