Skip to content

Commit

Permalink
Merge pull request #16 from narqo/master
Browse files Browse the repository at this point in the history
Using Util#format for message formatting
  • Loading branch information
tj committed May 3, 2013
2 parents a51c600 + acd433a commit de7d4a0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* Module dependencies.
*/

var EventEmitter = require('events').EventEmitter;
var frmt = require('util').format
, EventEmitter = require('events').EventEmitter;

/**
* Initialize a `Loggeer` with the given log `level` defaulting
Expand Down Expand Up @@ -144,10 +145,7 @@ Log.prototype = {

log: function(levelStr, args) {
if (exports[levelStr] <= this.level) {
var i = 1;
var msg = args[0].replace(/%s/g, function(){
return args[i++];
});
var msg = frmt.apply(null, args);
this.stream.write(
'[' + new Date + ']'
+ ' ' + levelStr
Expand Down

0 comments on commit de7d4a0

Please sign in to comment.