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

debug-logtron

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debug-logtron - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

6

backends/debug-log-backend.js

@@ -21,2 +21,3 @@ 'use strict';

function DebugLogBackend(namespace, opts) {
/*eslint max-statements: [2, 25]*/
if (!(this instanceof DebugLogBackend)) {

@@ -44,3 +45,6 @@ return new DebugLogBackend(namespace, opts);

if (self.verbose) {
if (opts.verbose) {
self.verbose = true;
}
if (self.verbose || opts.enabled) {
self.enabled = true;

@@ -47,0 +51,0 @@ }

2

package.json
{
"name": "debug-logtron",
"version": "3.0.0",
"version": "3.1.0",
"description": "A debug logger with a logtron interface.",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -267,2 +267,26 @@ 'use strict';

test('prints warn/info if enabled', function t(assert) {
var lines = [];
var logger = DebugLogtron('wat', {
console: {
error: function log(x) {
lines.push(x);
}
},
enabled: true
});
logger.info('hi');
assert.equal(lines.length, 1);
assert.ok(lines[0].indexOf('INFO: hi ~ null') >= 0);
lines = [];
logger.debug('roflcopter');
assert.equal(lines.length, 0);
assert.end();
});
test('prints debug/access/trace if NODE_DEBUG verbose', function t(assert) {

@@ -301,2 +325,33 @@ var lines = [];

test('prints debug/access/trace if verbose', function t(assert) {
var lines = [];
var logger = DebugLogtron('wat', {
console: {
error: function log(x) {
lines.push(x);
}
},
verbose: true
});
logger.debug('hi');
assert.equal(lines.length, 1);
assert.ok(lines[0].indexOf('DEBUG: hi ~ null') >= 0);
logger.info('hi');
assert.equal(lines.length, 2);
assert.ok(lines[1].indexOf('INFO: hi ~ null') >= 0);
assert.throws(function throwIt() {
logger.error('hi');
}, 'hi');
assert.equal(lines.length, 3);
assert.ok(lines[2].indexOf('ERROR: hi ~ null') >= 0);
assert.end();
});
function allocLogger(opts) {

@@ -303,0 +358,0 @@ opts = opts || {};

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