New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

better-logs

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-logs - npm Package Compare versions

Comparing version 2.0.1 to 2.1.1

22

controller.js

@@ -19,9 +19,9 @@ var _ = require('lodash');

this._groups = {};
this._formats = {};
this._modes = {};
this._visible = {}; // Map section => Map type => Boolean
this._outputs = {}; // Map section => Map type => Writable
this._groups = {}; // Map group => array of sections
this._formats = {}; // Map type => format function
this._modes = {}; // Map mode => mode options
this._display = {}; // Display options
this._outputs = {}; // [section|_default][type|_default]
this._visible = {}; // [section|_default][type|_default]
if (typeof opts === 'object') {

@@ -198,3 +198,3 @@ this.config(opts);

var message = ctl._formats[type].apply(extend({ logType: type }, _.pick(log, ['dateformat', 'section', 'stackIndex', 'maxTraceDepth'])), arguments);
var message = ctl._formats[type].apply(extend({ section: log.section, logType: type }, ctl._display, log._display), arguments);
// console.log('writing', message)

@@ -260,2 +260,5 @@

var self = this;
if (typeof opts.display === 'object') {
extend(self._display, opts.display);
}
if (opts.groups) {

@@ -307,2 +310,7 @@ Object.keys(opts.groups).forEach(function (name) { return self.group(name, opts.groups[name]) })

Controller.prototype.display = function (key, val) {
if (typeof key !== 'string') return;
this._display[key] = val;
}
Controller.prototype.modes = function () {

@@ -309,0 +317,0 @@ return Object.keys(this._modes);

@@ -16,8 +16,14 @@ //

controller.config({
mode: 'normal',
outputs: {
_default: process.stdout
_default: process.stdout,
},
groups: {
normal: ['info', 'warn', 'error'],
},
display: {
dateformat: 'yyyy-mm-dd HH:MM:ss',
stackIndex: 1,
maxTraceDepth: 20,
},
formats: {

@@ -31,10 +37,8 @@ log: "{{timestamp}}".grey + " info".cyan + " [{{section}}] {{message}}".white + " ({{file}}:{{line}})".grey,

modes: {
normal: ['info', 'warn', 'error'],
verbose: ['trace', 'normal', 'debug', 'console'],
test: ['test'],
critical: ['error'],
silent: [],
normal: { show: ['normal'] },
verbose: { show: ['normal', 'debug', 'console'] },
test: { showByDefault: false, show: ['test'] },
critical: { showByDefault: false, show: ['error'] },
silent: { showByDefault: false },
},
output: 'console',
mode: 'normal',
showByDefault: true,

@@ -41,0 +45,0 @@ show: [],

@@ -10,7 +10,5 @@ var util = require('util');

this.section = opts.section || 'general';
this.stackIndex = opts.stackIndex || 1;
this.maxTraceDepth = opts.maxTraceDepth || 20;
this.dateformat = opts.dateformat || 'yyyy-mm-dd HH:MM:ss';
this.started = false;
this.started = false;
this._display = {};
this._unwritten = [];

@@ -17,0 +15,0 @@

{
"name": "better-logs",
"version": "2.0.1",
"version": "2.1.1",
"description": "Really flexible and fast logger for web servers, applications and daemons",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -154,3 +154,3 @@ var assert = require('assert');

var log = BetterLogs('testSectionName');
log.dateformat = 'HH:MM year: yyyy'
log.config({ display: { dateformat: 'HH:MM year: yyyy' } })
log.format('testFormatTime', '{{timestamp}}');

@@ -157,0 +157,0 @@ var logged = '';

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