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

cli-logger

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-logger - npm Package Compare versions

Comparing version 0.5.6 to 0.5.9

22

index.js

@@ -43,2 +43,3 @@ var EventEmitter = require('events').EventEmitter;

json: false,
trace: true,
src: false,

@@ -112,2 +113,14 @@ hostname: null,

Logger.prototype.useConsoleStream = function() {
var stream = new ConsoleStream({writers: this.conf.writers});
stream.logger(this);
this.streams[0].stream = stream;
this.streams[0].type = CONSOLE;
}
Logger.prototype.isDefault = function() {
return this.streams.length === 1
&& this.streams[0].stream === process.stdout;
}
/**

@@ -434,3 +447,10 @@ * Configure instance log levels.

if(level && !message) return this.enabled(level);
var info = this.getLogRecord.apply(this, arguments);
var args = [].slice.call(arguments, 0);
if((args[1] instanceof Error)
&& !this.conf.json && this.conf.trace
&& (args[1].stack)) {
args[1] = arguments[1].stack;
args = args.slice(0, 2);
}
var info = this.getLogRecord.apply(this, args);
return this.write(level, info.record, info.parameters);

@@ -437,0 +457,0 @@ }

7

lib/console-stream.js

@@ -22,3 +22,3 @@ var EventEmitter = require('events').EventEmitter;

ConsoleStream.prototype.logger = function(log) {
var writers = this.options.writers || {};
var writers = this.options.writers || log.conf.writers || {};
if(typeof writers === 'function') {

@@ -63,2 +63,3 @@ var writer = writers;

ConsoleStream.prototype.write = function(record, prefix) {
var msg = record.message, newline = msg ? ~msg.indexOf('\n') : false;
var level = record.level, writer = this.writers[level], scope = this;

@@ -69,2 +70,5 @@ function println(msg, parameters) {

}
if(msg instanceof Error) {
console.dir('console stream error');
}
if(writer) {

@@ -74,3 +78,2 @@ if(!prefix) return println(msg, record.parameters);

// prefix all lines
var msg = record.message, newline = ~msg.indexOf('\n');
// check parameters for a newline

@@ -77,0 +80,0 @@ if(!newline) {

{
"name": "cli-logger",
"version": "0.5.6",
"version": "0.5.9",
"description": "Logger implementation for command line interfaces",

@@ -23,3 +23,3 @@ "author": "muji <noop@xpm.io>",

"dependencies": {
"ttycolor": "~0.8.4",
"ttycolor": "~0.8.6",
"cli-util": "~1.1.6",

@@ -26,0 +26,0 @@ "circular": "~1.0.2"

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