Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

caterpillar

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caterpillar - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

LICENSE.md

29

out/lib/caterpillar.js

@@ -1,20 +0,17 @@

// Generated by CoffeeScript 1.3.3
(function() {
var ConsoleFormatter, ConsoleTransport, Formatter, Logger, Transport, cliColor, _ref, _ref1;
// Generated by CoffeeScript 1.6.2
var ConsoleFormatter, ConsoleTransport, Formatter, Logger, Transport, cliColor, _ref, _ref1;
_ref = require(__dirname + '/formatter'), cliColor = _ref.cliColor, Formatter = _ref.Formatter, ConsoleFormatter = _ref.ConsoleFormatter;
_ref = require(__dirname + '/formatter'), cliColor = _ref.cliColor, Formatter = _ref.Formatter, ConsoleFormatter = _ref.ConsoleFormatter;
Logger = require(__dirname + '/logger').Logger;
Logger = require(__dirname + '/logger').Logger;
_ref1 = require(__dirname + '/transport'), Transport = _ref1.Transport, ConsoleTransport = _ref1.ConsoleTransport;
_ref1 = require(__dirname + '/transport'), Transport = _ref1.Transport, ConsoleTransport = _ref1.ConsoleTransport;
module.exports = {
cliColor: cliColor,
Formatter: Formatter,
ConsoleFormatter: ConsoleFormatter,
Logger: Logger,
Transport: Transport,
ConsoleTransport: ConsoleTransport
};
}).call(this);
module.exports = {
cliColor: cliColor,
Formatter: Formatter,
ConsoleFormatter: ConsoleFormatter,
Logger: Logger,
Transport: Transport,
ConsoleTransport: ConsoleTransport
};

@@ -1,210 +0,218 @@

// Generated by CoffeeScript 1.3.3
(function() {
var ConsoleFormatter, Formatter, cliColor, util,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
// Generated by CoffeeScript 1.6.2
var ConsoleFormatter, Formatter, cliColor, err, util, _ref,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
util = require('util');
util = require('util');
try {
cliColor = require('cli-color');
} catch (err) {
cliColor = null;
}
try {
cliColor = require('cli-color');
} catch (_error) {
err = _error;
cliColor = null;
}
Formatter = (function() {
Formatter = (function() {
Formatter.prototype.config = {
colors: {
0: 'red',
1: 'red',
2: 'red',
3: 'red',
4: 'yellow',
5: 'yellow',
6: 'green',
7: 'green'
},
level: 7
};
Formatter.prototype.config = {
colors: {
0: 'red',
1: 'red',
2: 'red',
3: 'red',
4: 'yellow',
5: 'yellow',
6: 'green',
7: 'green'
},
level: 7
};
function Formatter(config) {
var key, value, _ref, _ref1;
function Formatter(config) {
var key, value, _ref, _ref1;
config || (config = {});
_ref = this.config;
for (key in _ref) {
if (!__hasProp.call(_ref, key)) continue;
value = _ref[key];
if ((_ref1 = config[key]) == null) {
config[key] = value;
}
config || (config = {});
_ref = this.config;
for (key in _ref) {
if (!__hasProp.call(_ref, key)) continue;
value = _ref[key];
if ((_ref1 = config[key]) == null) {
config[key] = value;
}
this.config = config;
}
this.config = config;
}
Formatter.prototype.getLevel = function() {
var _ref;
return (_ref = this.config.level) != null ? _ref : null;
};
Formatter.prototype.getLevel = function() {
var _ref;
Formatter.prototype.setLevel = function(level) {
this.config.level = level;
return this;
};
return (_ref = this.config.level) != null ? _ref : null;
};
Formatter.prototype.padLeft = function(padding, size, msg) {
var i, _i, _ref;
padding = String(padding);
msg = String(msg);
if (msg.length < size) {
for (i = _i = 0, _ref = size - msg.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
msg = padding + msg;
}
}
return msg;
};
Formatter.prototype.setLevel = function(level) {
this.config.level = level;
return this;
};
Formatter.prototype.padRight = function(padding, size, msg) {
var i, _i, _ref;
padding = String(padding);
msg = String(msg);
if (msg.length < size) {
for (i = _i = 0, _ref = size - msg.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
msg += padding;
}
}
return msg;
};
Formatter.prototype.padLeft = function(padding, size, msg) {
var i, _i, _ref;
Formatter.prototype.details = function(levelCode, levelName, args) {
var color, date, file, index, line, message, method, parts, value, _i, _len, _ref;
date = this.getDate();
_ref = this.getLineInfo(), file = _ref.file, line = _ref.line, method = _ref.method;
color = this.getColor(levelCode);
parts = [];
for (index = _i = 0, _len = args.length; _i < _len; index = ++_i) {
value = args[index];
parts[index] = typeof value === 'string' ? value : util.inspect(value, false, 10);
padding = String(padding);
msg = String(msg);
if (msg.length < size) {
for (i = _i = 0, _ref = size - msg.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
msg = padding + msg;
}
message = parts.join(' ');
return {
date: date,
file: file,
line: line,
method: method,
color: color,
levelName: levelName,
message: message
};
};
}
return msg;
};
Formatter.prototype.format = function(levelCode, levelName, args) {
var className, date, line, message, _ref;
_ref = this.details(levelCode, levelName, args), date = _ref.date, className = _ref.className, line = _ref.line, levelName = _ref.levelName, message = _ref.message;
if (this.config.level === 7) {
return message = ("[" + date + "] [" + className + ": " + line + "] ") + this.padLeft(' ', 10, "" + levelName + ":") + (" " + message);
} else {
return message = this.padLeft(' ', 10, "" + levelName + ":") + (" " + message);
Formatter.prototype.padRight = function(padding, size, msg) {
var i, _i, _ref;
padding = String(padding);
msg = String(msg);
if (msg.length < size) {
for (i = _i = 0, _ref = size - msg.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
msg += padding;
}
};
}
return msg;
};
Formatter.prototype.getColor = function(levelCode) {
var color;
return color = this.config.colors ? this.config.colors[levelCode] : false;
};
Formatter.prototype.details = function(levelCode, levelName, args) {
var color, date, file, index, line, message, method, parts, value, _i, _len, _ref;
Formatter.prototype.getDate = function() {
var date, hours, minutes, month, ms, now, seconds, year;
now = new Date();
year = now.getFullYear();
month = this.padLeft('0', 2, now.getMonth() + 1);
date = this.padLeft('0', 2, now.getDate());
hours = this.padLeft('0', 2, now.getHours());
minutes = this.padLeft('0', 2, now.getMinutes());
seconds = this.padLeft('0', 2, now.getSeconds());
ms = this.padLeft('0', 3, now.getMilliseconds());
return "" + year + "-" + month + "-" + date + " " + hours + ":" + minutes + ":" + seconds + "." + ms;
date = this.getDate();
_ref = this.getLineInfo(), file = _ref.file, line = _ref.line, method = _ref.method;
color = this.getColor(levelCode);
parts = [];
for (index = _i = 0, _len = args.length; _i < _len; index = ++_i) {
value = args[index];
parts[index] = typeof value === 'string' ? value : util.inspect(value, false, 10);
}
message = parts.join(' ');
return {
date: date,
file: file,
line: line,
method: method,
color: color,
levelName: levelName,
message: message
};
};
Formatter.prototype.getLineInfo = function() {
var line, lines, parts, result, _i, _len;
result = {
line: -1,
method: 'unknown'
};
try {
throw new Error();
} catch (e) {
lines = e.stack.split('\n');
for (_i = 0, _len = lines.length; _i < _len; _i++) {
line = lines[_i];
if (line.indexOf(__dirname) !== -1 || line.indexOf(' at ') === -1) {
continue;
}
parts = line.split(':');
if (parts[0].indexOf('(') === -1) {
result.method = 'unknown';
result.file = parts[0].replace(/^.+?\s+at\s+/, '');
} else {
result.method = parts[0].replace(/^.+?\s+at\s+/, '').replace(/\s+\(.+$/, '');
result.file = parts[0].replace(/^.+?\(/, '');
}
result.line = parts[1];
break;
}
}
return result;
};
Formatter.prototype.format = function(levelCode, levelName, args) {
var className, date, line, message, _ref;
return Formatter;
_ref = this.details(levelCode, levelName, args), date = _ref.date, className = _ref.className, line = _ref.line, levelName = _ref.levelName, message = _ref.message;
if (this.config.level === 7) {
return message = ("[" + date + "] [" + className + ": " + line + "] ") + this.padLeft(' ', 10, "" + levelName + ":") + (" " + message);
} else {
return message = this.padLeft(' ', 10, "" + levelName + ":") + (" " + message);
}
};
})();
Formatter.prototype.getColor = function(levelCode) {
var color;
ConsoleFormatter = (function(_super) {
return color = this.config.colors ? this.config.colors[levelCode] : false;
};
__extends(ConsoleFormatter, _super);
Formatter.prototype.getDate = function() {
var date, hours, minutes, month, ms, now, seconds, year;
function ConsoleFormatter() {
return ConsoleFormatter.__super__.constructor.apply(this, arguments);
}
now = new Date();
year = now.getFullYear();
month = this.padLeft('0', 2, now.getMonth() + 1);
date = this.padLeft('0', 2, now.getDate());
hours = this.padLeft('0', 2, now.getHours());
minutes = this.padLeft('0', 2, now.getMinutes());
seconds = this.padLeft('0', 2, now.getSeconds());
ms = this.padLeft('0', 3, now.getMilliseconds());
return "" + year + "-" + month + "-" + date + " " + hours + ":" + minutes + ":" + seconds + "." + ms;
};
ConsoleFormatter.prototype.format = function(levelCode, levelName, args) {
var color, date, debugFormatter, debugString, file, line, message, messageFormatter, messageString, method, seperator, _ref;
_ref = this.details(levelCode, levelName, args), date = _ref.date, file = _ref.file, line = _ref.line, method = _ref.method, color = _ref.color, levelName = _ref.levelName, message = _ref.message;
if (!message) {
return message;
} else {
color = color && (cliColor != null ? cliColor[color] : void 0) || function(str) {
return str;
};
levelName = color(levelName + ':');
debugFormatter = false;
messageFormatter = color && (cliColor != null ? cliColor.bold : void 0);
messageString = "" + levelName + " " + message;
if (messageFormatter) {
messageString = messageFormatter(messageString);
Formatter.prototype.getLineInfo = function() {
var e, line, lines, parts, result, _i, _len;
result = {
line: -1,
method: 'unknown'
};
try {
throw new Error();
} catch (_error) {
e = _error;
lines = e.stack.split('\n');
for (_i = 0, _len = lines.length; _i < _len; _i++) {
line = lines[_i];
if (line.indexOf(__dirname) !== -1 || line.indexOf(' at ') === -1) {
continue;
}
if (this.config.level === 7) {
seperator = '\n → ';
debugString = "[" + date + "] [" + file + ":" + line + "] [" + method + "]";
if (debugFormatter) {
debugString = lineFormatter(debugString);
}
return message = "" + messageString + seperator + debugString;
parts = line.split(':');
if (parts[0].indexOf('(') === -1) {
result.method = 'unknown';
result.file = parts[0].replace(/^.+?\s+at\s+/, '');
} else {
return message = messageString;
result.method = parts[0].replace(/^.+?\s+at\s+/, '').replace(/\s+\(.+$/, '');
result.file = parts[0].replace(/^.+?\(/, '');
}
result.line = parts[1];
break;
}
};
}
return result;
};
return ConsoleFormatter;
return Formatter;
})(Formatter);
})();
module.exports = {
cliColor: cliColor,
Formatter: Formatter,
ConsoleFormatter: ConsoleFormatter
ConsoleFormatter = (function(_super) {
__extends(ConsoleFormatter, _super);
function ConsoleFormatter() {
_ref = ConsoleFormatter.__super__.constructor.apply(this, arguments);
return _ref;
}
ConsoleFormatter.prototype.format = function(levelCode, levelName, args) {
var color, date, debugFormatter, debugString, file, line, message, messageFormatter, messageString, method, seperator, _ref1;
_ref1 = this.details(levelCode, levelName, args), date = _ref1.date, file = _ref1.file, line = _ref1.line, method = _ref1.method, color = _ref1.color, levelName = _ref1.levelName, message = _ref1.message;
if (!message) {
return message;
} else {
color = color && (cliColor != null ? cliColor[color] : void 0) || function(str) {
return str;
};
levelName = color(levelName + ':');
debugFormatter = false;
messageFormatter = color && (cliColor != null ? cliColor.bold : void 0);
messageString = "" + levelName + " " + message;
if (messageFormatter) {
messageString = messageFormatter(messageString);
}
if (this.config.level === 7) {
seperator = '\n → ';
debugString = "[" + date + "] [" + file + ":" + line + "] [" + method + "]";
if (debugFormatter) {
debugString = lineFormatter(debugString);
}
return message = "" + messageString + seperator + debugString;
} else {
return message = messageString;
}
}
};
}).call(this);
return ConsoleFormatter;
})(Formatter);
module.exports = {
cliColor: cliColor,
Formatter: Formatter,
ConsoleFormatter: ConsoleFormatter
};

@@ -1,174 +0,178 @@

// Generated by CoffeeScript 1.3.3
(function() {
var ConsoleTransport, Logger, Transport, _ref,
__hasProp = {}.hasOwnProperty,
__slice = [].slice;
// Generated by CoffeeScript 1.6.2
var ConsoleTransport, Logger, Transport, _ref,
__hasProp = {}.hasOwnProperty,
__slice = [].slice;
_ref = require(__dirname + '/transport'), Transport = _ref.Transport, ConsoleTransport = _ref.ConsoleTransport;
_ref = require(__dirname + '/transport'), Transport = _ref.Transport, ConsoleTransport = _ref.ConsoleTransport;
Logger = (function() {
Logger = (function() {
Logger.prototype.config = {
autoFlush: true,
transports: null,
level: 7,
levels: {
emergency: 0,
alert: 1,
critical: 2,
error: 3,
warning: 4,
notice: 5,
info: 6,
debug: 7,
emerg: 0,
crit: 2,
err: 3,
warn: 4,
note: 5,
"default": 6
}
};
Logger.prototype.config = {
autoFlush: true,
transports: null,
level: 7,
levels: {
emergency: 0,
alert: 1,
critical: 2,
error: 3,
warning: 4,
notice: 5,
info: 6,
debug: 7,
emerg: 0,
crit: 2,
err: 3,
warn: 4,
note: 5,
"default": 6
}
};
Logger.prototype.messages = [];
Logger.prototype.messages = [];
Logger.prototype.formatter = null;
Logger.prototype.formatter = null;
Logger.prototype.transports = [];
Logger.prototype.transports = [];
function Logger(config) {
var key, levels, transport, value, _i, _len, _ref1, _ref2, _ref3, _ref4, _ref5;
function Logger(config) {
var key, levels, transport, value, _i, _len, _ref1, _ref2, _ref3, _ref4, _ref5;
this.messages = [];
this.transports = [];
config || (config = {});
_ref1 = this.config;
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
value = _ref1[key];
if ((_ref2 = config[key]) == null) {
config[key] = value;
}
this.messages = [];
this.transports = [];
config || (config = {});
_ref1 = this.config;
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
value = _ref1[key];
if ((_ref2 = config[key]) == null) {
config[key] = value;
}
levels = {};
_ref3 = config.levels;
for (key in _ref3) {
if (!__hasProp.call(_ref3, key)) continue;
value = _ref3[key];
if ((_ref4 = levels[key]) == null) {
levels[key] = value;
}
}
levels = {};
_ref3 = config.levels;
for (key in _ref3) {
if (!__hasProp.call(_ref3, key)) continue;
value = _ref3[key];
if ((_ref4 = levels[key]) == null) {
levels[key] = value;
}
config.levels = levels;
if (!config.transports) {
config.transports = new ConsoleTransport;
}
config.levels = levels;
if (!config.transports) {
config.transports = new ConsoleTransport;
}
if (!(config.transports instanceof Array)) {
config.transports = [config.transports];
}
_ref5 = config.transports;
for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
transport = _ref5[_i];
if (transport instanceof Transport) {
this.transports.push(transport);
} else if (transport) {
this.transports.push(new ConsoleTransport(transport));
}
if (!(config.transports instanceof Array)) {
config.transports = [config.transports];
}
_ref5 = config.transports;
for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
transport = _ref5[_i];
if (transport instanceof Transport) {
this.transports.push(transport);
} else if (transport) {
this.transports.push(new ConsoleTransport(transport));
}
}
delete config.transports;
if (config.level) {
this.setLevel(config.level);
}
this.config = config;
}
delete config.transports;
if (config.level) {
this.setLevel(config.level);
}
this.config = config;
}
Logger.prototype.getLevel = function() {
var _ref1;
return (_ref1 = this.config.level) != null ? _ref1 : null;
};
Logger.prototype.getLevel = function() {
var _ref1;
Logger.prototype.setLevel = function(level) {
var transport, _i, _len, _ref1;
this.config.level = level;
_ref1 = this.transports;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
transport = _ref1[_i];
transport.setLevel(level);
}
return this;
};
return (_ref1 = this.config.level) != null ? _ref1 : null;
};
Logger.prototype.getLevelCode = function(name) {
var _ref1;
return (_ref1 = this.config.levels[name]) != null ? _ref1 : null;
};
Logger.prototype.setLevel = function(level) {
var transport, _i, _len, _ref1;
Logger.prototype.getLevelName = function(code) {
var key, value, _ref1;
_ref1 = this.config.levels;
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
value = _ref1[key];
if (value === code) {
return key;
}
this.config.level = level;
_ref1 = this.transports;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
transport = _ref1[_i];
transport.setLevel(level);
}
return this;
};
Logger.prototype.getLevelCode = function(name) {
var _ref1;
return (_ref1 = this.config.levels[name]) != null ? _ref1 : null;
};
Logger.prototype.getLevelName = function(code) {
var key, value, _ref1;
_ref1 = this.config.levels;
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
value = _ref1[key];
if (value === code) {
return key;
}
return null;
};
}
return null;
};
Logger.prototype.log = function() {
var args, level, levelCode, levelName;
level = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
if (typeof level === 'number') {
levelCode = level;
Logger.prototype.log = function() {
var args, level, levelCode, levelName;
level = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
if (typeof level === 'number') {
levelCode = level;
levelName = this.getLevelName(levelCode);
} else {
levelName = level;
levelCode = this.getLevelCode(levelName);
levelName = this.getLevelName(levelCode);
if (levelCode == null) {
levelCode = this.getLevelCode('default');
levelName = this.getLevelName(levelCode);
} else {
levelName = level;
levelCode = this.getLevelCode(levelName);
levelName = this.getLevelName(levelCode);
if (levelCode == null) {
levelCode = this.getLevelCode('default');
levelName = this.getLevelName(levelCode);
args.unshift(level);
}
args.unshift(level);
}
if (this.config.autoFlush) {
this.write(levelCode, levelName, args);
} else {
this.messages.push({
levelCode: levelCode,
levelName: levelName,
args: args
});
}
return this;
};
}
if (this.config.autoFlush) {
this.write(levelCode, levelName, args);
} else {
this.messages.push({
levelCode: levelCode,
levelName: levelName,
args: args
});
}
return this;
};
Logger.prototype.flush = function() {
var args, levelCode, levelName, _i, _len, _ref1, _ref2;
_ref1 = this.messages;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
_ref2 = _ref1[_i], levelCode = _ref2.levelCode, levelName = _ref2.levelName, args = _ref2.args;
this.write(levelCode, levelName, args);
}
return this;
};
Logger.prototype.flush = function() {
var args, levelCode, levelName, _i, _len, _ref1, _ref2;
Logger.prototype.write = function(levelCode, levelName, args) {
var transport, _i, _len, _ref1;
_ref1 = this.transports;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
transport = _ref1[_i];
transport.write(levelCode, levelName, args);
}
return this;
};
_ref1 = this.messages;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
_ref2 = _ref1[_i], levelCode = _ref2.levelCode, levelName = _ref2.levelName, args = _ref2.args;
this.write(levelCode, levelName, args);
}
return this;
};
return Logger;
Logger.prototype.write = function(levelCode, levelName, args) {
var transport, _i, _len, _ref1;
})();
module.exports = {
Logger: Logger
_ref1 = this.transports;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
transport = _ref1[_i];
transport.write(levelCode, levelName, args);
}
return this;
};
}).call(this);
return Logger;
})();
module.exports = {
Logger: Logger
};

@@ -1,89 +0,87 @@

// Generated by CoffeeScript 1.3.3
(function() {
var ConsoleFormatter, ConsoleTransport, Formatter, Transport, _ref,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
// Generated by CoffeeScript 1.6.2
var ConsoleFormatter, ConsoleTransport, Formatter, Transport, _ref, _ref1,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
_ref = require(__dirname + '/formatter'), Formatter = _ref.Formatter, ConsoleFormatter = _ref.ConsoleFormatter;
_ref = require(__dirname + '/formatter'), Formatter = _ref.Formatter, ConsoleFormatter = _ref.ConsoleFormatter;
Transport = (function() {
Transport = (function() {
Transport.prototype.config = {
level: 7,
formatter: null
};
Transport.prototype.config = {
level: 7,
formatter: null
};
function Transport(config) {
var key, value, _ref1, _ref2;
function Transport(config) {
var key, value, _ref1, _ref2;
config || (config = {});
_ref1 = this.config;
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
value = _ref1[key];
if ((_ref2 = config[key]) == null) {
config[key] = value;
}
config || (config = {});
_ref1 = this.config;
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
value = _ref1[key];
if ((_ref2 = config[key]) == null) {
config[key] = value;
}
if (config.formatter instanceof Formatter) {
this.formatter = config.formatter;
} else {
this.formatter = new ConsoleFormatter(config.formatter);
}
delete config.formatter;
this.config = config;
}
if (config.formatter instanceof Formatter) {
this.formatter = config.formatter;
} else {
this.formatter = new ConsoleFormatter(config.formatter);
}
delete config.formatter;
this.config = config;
}
Transport.prototype.getLevel = function() {
var _ref1;
return (_ref1 = this.config.level) != null ? _ref1 : null;
};
Transport.prototype.getLevel = function() {
var _ref1;
Transport.prototype.setLevel = function(level) {
this.config.level = level;
if (this.formatter) {
this.formatter.setLevel(level);
}
return this;
};
return (_ref1 = this.config.level) != null ? _ref1 : null;
};
Transport.prototype.care = function(levelCode) {
return levelCode <= this.config.level;
};
Transport.prototype.setLevel = function(level) {
this.config.level = level;
if (this.formatter) {
this.formatter.setLevel(level);
}
return this;
};
Transport.prototype.write = function(levelCode, levelName, message) {
if (this.care(levelCode)) {
return message = this.formatter.format(levelCode, levelName, message);
} else {
return null;
}
};
Transport.prototype.care = function(levelCode) {
return levelCode <= this.config.level;
};
return Transport;
Transport.prototype.write = function(levelCode, levelName, message) {
if (this.care(levelCode)) {
return message = this.formatter.format(levelCode, levelName, message);
} else {
return null;
}
};
})();
return Transport;
ConsoleTransport = (function(_super) {
})();
__extends(ConsoleTransport, _super);
ConsoleTransport = (function(_super) {
__extends(ConsoleTransport, _super);
function ConsoleTransport() {
return ConsoleTransport.__super__.constructor.apply(this, arguments);
function ConsoleTransport() {
_ref1 = ConsoleTransport.__super__.constructor.apply(this, arguments);
return _ref1;
}
ConsoleTransport.prototype.write = function(levelCode, levelName, message) {
message = ConsoleTransport.__super__.write.call(this, levelCode, levelName, message);
if (message != null) {
return console.log(message);
}
};
ConsoleTransport.prototype.write = function(levelCode, levelName, message) {
message = ConsoleTransport.__super__.write.call(this, levelCode, levelName, message);
if (message != null) {
return console.log(message);
}
};
return ConsoleTransport;
return ConsoleTransport;
})(Transport);
})(Transport);
module.exports = {
Transport: Transport,
ConsoleTransport: ConsoleTransport
};
}).call(this);
module.exports = {
Transport: Transport,
ConsoleTransport: ConsoleTransport
};
{
"name": "caterpillar",
"version": "1.1.3",
"description": "Caterpillar is an awesome, simple console logger for node.js. It supports grouping of messages, filtering log levels, colors, times, modules, custom formatters and custom transports. It's awesome.",
"version": "1.1.4",
"description": "Caterpillar is a simple but powerful console logger for node.js. It supports grouping of messages, filtering log levels, colors, times, modules, custom formatters and custom transports.",
"homepage": "https://github.com/bevry/caterpillar",

@@ -15,6 +15,6 @@ "keywords": [

"maintainers": [
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],
"contributors": [
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],

@@ -29,10 +29,10 @@ "bugs": {

"engines" : {
"node": ">=0.4.0"
"node": ">=0.4"
},
"dependencies": {},
"optionalDependencies": {
"cli-color": "0.2.x"
"cli-color": "~0.2.2"
},
"devDependencies": {
"coffee-script": "1.3.x"
"coffee-script": "~1.6.2"
},

@@ -42,3 +42,3 @@ "directories": {

},
"main": "./out/lib/caterpillar"
"main": "./out/lib/caterpillar.js"
}
# Caterpillar
Caterpillar is an awesome, simple, intuitive console logger for [Node.js](http://nodejs.org/). It supports grouping of messages, filtering log levels, colors, times, modules, custom formatters and custom transports
Caterpillar is a simple but powerful intuitive console logger for [Node.js](http://nodejs.org/). It supports grouping of messages, filtering log levels, colors, times, modules, custom formatters and custom transports.

@@ -26,3 +26,3 @@

Please refer to the [console example](https://github.com/bevry/caterpillar/blob/master/example/console.coffee#files) for usage
Refer to the [console example](https://github.com/bevry/caterpillar/blob/master/example/console.coffee#files) for usage

@@ -32,7 +32,9 @@

1. [Install Node.js](https://github.com/balupton/node/wiki/Installing-Node.js)
1. [Install Node.js](http://bevry.me/node/install)
1. Install Caterpillar
npm install caterpillar
```
npm install caterpillar
```

@@ -48,3 +50,3 @@

Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
<br/>Copyright &copy; 2012 [Bevry Pty Ltd](http://bevry.me)
<br/>Copyright &copy; 2012+ [Bevry Pty Ltd](http://bevry.me)
<br/>Copyright &copy; 2011 [Benjamin Lupton](http://balupton.com)

@@ -51,0 +53,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc