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 2.0.1 to 2.0.2

debug.log

5

example.js

@@ -10,2 +10,7 @@ // Import

// If we are debugging, then write the original logger data to debug.log
if ( level === 7 ) {
logger.pipe(require('fs').createWriteStream('./debug.log'));
}
// Log messages

@@ -12,0 +17,0 @@ logger.log('emergency', 'this is level 0');

31

out/lib/caterpillar.js

@@ -116,3 +116,4 @@ // Generated by CoffeeScript 1.6.2

levelNumber: null,
levelName: null
levelName: null,
defaulted: false
};

@@ -129,2 +130,3 @@ if (typeof level === 'number') {

levelName = this.getLevelName(levelNumber);
result.defaulted = true;
}

@@ -167,20 +169,15 @@ }

Logger.prototype.format = function() {
var args, entry, key, level, value, _ref1, _ref2;
var args, entry, level, levelInfo, lineInfo;
level = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
entry = {};
entry.args = args;
entry.date = new Date().toISOString();
_ref1 = this.getLevelInfo(level);
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
value = _ref1[key];
entry[key] = value;
levelInfo = this.getLevelInfo(level);
lineInfo = this.getLineInfo(level);
if (levelInfo.defaulted && level !== 'default') {
args.unshift(level);
}
_ref2 = this.getLineInfo(level);
for (key in _ref2) {
if (!__hasProp.call(_ref2, key)) continue;
value = _ref2[key];
entry[key] = value;
}
delete levelInfo.defaulted;
entry.args = args;
extendr.extend(entry, levelInfo, lineInfo);
return entry;

@@ -190,6 +187,6 @@ };

Logger.prototype.log = function() {
var args, entry, entryString, level;
var args, entry, entryString;
level = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
entry = this.format.apply(this, [level].concat(__slice.call(args)));
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
entry = this.format.apply(this, args);
entryString = JSON.stringify(entry);

@@ -196,0 +193,0 @@ this.write(entryString);

{
"name": "caterpillar",
"version": "2.0.1",
"description": "Caterpillar is the ultimate logging system for Node.js, based on transform streams you can log to it and pipe the output off to different locations, including some pre-made ones. Caterpillar also supports log levels according to the RFC standard, as well as line, method, and file fetching for messages.",
"version": "2.0.2",
"description": "Caterpillar is the ultimate logging system for Node.js, based on transform streams you can log to it and pipe the output off to different locations, including some pre-made ones. Caterpillar also supports log levels according to the RFC standard, as well as line, method, and file fetching for messages. You can even use it in web browsers with caterpillar-browser.",
"homepage": "https://github.com/bevry/caterpillar",

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

@@ -7,3 +7,3 @@ # Caterpillar

Caterpillar is the ultimate logging system for Node.js, based on [transform streams](http://nodejs.org/api/stream.html#stream_class_stream_transform) you can log to it and pipe the output off to different locations, including [some pre-made ones](http://npmjs.org/keyword/caterpillar-transform). Caterpillar also supports log levels according to the [RFC standard](http://www.faqs.org/rfcs/rfc3164.html), as well as line, method, and file fetching for messages.
Caterpillar is the ultimate logging system for Node.js, based on [transform streams](http://nodejs.org/api/stream.html#stream_class_stream_transform) you can log to it and pipe the output off to different locations, including [some pre-made ones](http://npmjs.org/keyword/caterpillar-transform). Caterpillar also supports log levels according to the [RFC standard](http://www.faqs.org/rfcs/rfc3164.html), as well as line, method, and file fetching for messages. You can even use it in web browsers with the [Browser Transform](https://github.com/bevry/caterpillar-browser).

@@ -39,2 +39,7 @@

// If we are debugging, then write the original logger data to debug.log
if ( level === 7 ) {
logger.pipe(require('fs').createWriteStream('./debug.log'));
}
// Log messages

@@ -76,3 +81,3 @@ logger.log('emergency', 'this is level 0');

- Methods
- `constructor(config?)` create our new filter instance with the config, config is optional
- `constructor(config?)` create our new instance with the config, config is optional
- `pipe(child)` pipe our stream to the child, also sync our config to it

@@ -95,3 +100,3 @@ - `setConfig(config)` set the configuration and emit the `config` event

- Methods
- `constructor(config?)` create our new filter instance with the config, config is optional
- `constructor(config?)` create our new instance with the config, config is optional
- `log(args...)` write a log message, the first argument is suppose to be the level (will use the default level if it isn't)

@@ -98,0 +103,0 @@ - `format(level, args...)` create a log entry ready for writing to the logger stream, output is as follows:

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