Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE.
*/

var path = require('path'),
sys = require('sys'),
util = require('util'),
fs = require('fs');

var makeArray = function(nonarray) {
Expand All @@ -40,7 +40,7 @@ var makeArray = function(nonarray) {
// if `log_file_path` is null, log to STDOUT.
var Logger = function(log_file_path) {
// default write is STDOUT
this.write = sys.print;
this.write = util.print;
this.log_level_index = 3;

// if a path is given, try to write to it
Expand Down Expand Up @@ -71,7 +71,7 @@ Logger.prototype.setLevel = function(new_level) {

// The base logging method. If the first argument is one of the levels, it logs
// to that level, otherwise, logs to the default level. Can take `n` arguments
// and joins them by ' '. If the argument is not a string, it runs `sys.inspect()`
// and joins them by ' '. If the argument is not a string, it runs `util.inspect()`
// to print a string representation of the object.
Logger.prototype.log = function() {
var args = makeArray(arguments),
Expand All @@ -91,7 +91,7 @@ Logger.prototype.log = function() {
if (typeof arg === 'string') {
message += ' ' + arg;
} else {
message += ' ' + sys.inspect(arg, false, null);
message += ' ' + util.inspect(arg, false, null);
}
});
message = this.format(Logger.levels[log_index], new Date(), message);
Expand All @@ -112,4 +112,4 @@ Logger.levels.forEach(function(level) {
exports.Logger = Logger;
exports.createLogger = function(log_file_path) {
return new Logger(log_file_path);
};
};