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

fm-log

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fm-log - npm Package Compare versions

Comparing version 4.3.0 to 4.4.0

4

lib/LogFactory.js

@@ -1,2 +0,1 @@

// jscs:disable requireNamedUnassignedFunctions
"use strict";

@@ -36,5 +35,2 @@

}
if( moduleName ) {
Logger.moduleMaxLength = Math.max( Logger.moduleMaxLength || 0, moduleName.length );
}
return this.instance( moduleName, stream );

@@ -41,0 +37,0 @@ }

22

lib/Logger.js

@@ -1,2 +0,1 @@

// jscs:disable requireNamedUnassignedFunctions
"use strict";

@@ -208,2 +207,7 @@

if( this.prefix ) {
Logger.prefixMaxLength = Math.max( Logger.prefixMaxLength || 0, this.prefix.length );
}
// Break up the logging subject into multiple lines as appropriate.

@@ -263,14 +267,14 @@ const toLog = MessageFormatter.generateLogStack( level, this.prefix, message, colorizer );

*/
var callSitePattern = /at (?:(.*?) )?\(?(.*):(\d+):(\d+)\)?/g;
var sites = stack.match( callSitePattern );
const callSitePattern = /at (?:(.*?) )?\(?(.*):(\d+):(\d+)\)?/g;
const sites = stack.match( callSitePattern );
// The method that invoked the logger is located at index 2 of the stack
if( sites && stackIndex <= sites.length ) {
var callSiteElementPattern = /at (?:(.*?) )?\(?(.*):(\d+):(\d+)\)?/;
const callSiteElementPattern = /at (?:(.*?) )?\(?(.*):(\d+):(\d+)\)?/;
// Pick apart
var callSiteElements = sites[ stackIndex ].match( callSiteElementPattern );
var functionName = "";
var fileName = "";
var line = -1;
var column = -1;
const callSiteElements = sites[ stackIndex ].match( callSiteElementPattern );
let functionName = "";
let fileName = "";
let line = -1;
let column = -1;
// Assume either 4 (no function name) or 5 elements.

@@ -277,0 +281,0 @@ if( callSiteElements.length === 5 ) {

@@ -70,3 +70,4 @@ "use strict";

static generateLogStack( level, prefix, subject, colorizer ) {
const subjectString = ( util.isArray( subject ) || typeof subject === "object" ) ? MessageFormatter.stringify( subject ) : subject.toString();
const subjectString = ( util.isArray( subject ) || typeof subject === "object" ) ? MessageFormatter.stringify(
subject ) : subject.toString();
const lines = subjectString.split( "\n" );

@@ -81,3 +82,3 @@ let levelString = LogLevels.render( level );

// Multiple lines, prepare them all nice like.
for( var lineIndex = 0, lineCount = lines.length; lineIndex < lineCount; ++lineIndex ) {
for( let lineIndex = 0, lineCount = lines.length; lineIndex < lineCount; ++lineIndex ) {
lines[ lineIndex ] = colorizer( levelString + " " + MessageFormatter.prefixMessage( prefix,

@@ -142,3 +143,3 @@ lines[ lineIndex ],

// In this case, don't pad anything.
if( !prefix && !Logger.moduleMaxLength ) {
if( !prefix && !Logger.prefixMaxLength ) {
return "";

@@ -149,4 +150,4 @@ }

return ( prefix && !multiline ) ?
`(${MessageFormatter.pad( prefix, Logger.moduleMaxLength, " " )})` :
MessageFormatter.pad( "", Logger.moduleMaxLength + 2, " " );
`(${MessageFormatter.pad( prefix, Logger.prefixMaxLength, " " )})` :
MessageFormatter.pad( "", Logger.prefixMaxLength + 2, " " );
}

@@ -153,0 +154,0 @@

{
"name": "fm-log",
"version": "4.3.0",
"version": "4.4.0",
"description": "Console logging facility for Node",

@@ -5,0 +5,0 @@ "main": "lib/log.js",

@@ -112,4 +112,4 @@ "use strict";

result.length.should.equal( 2 );
result[ 0 ].should.match( /\d \[INFO ] \( foo\) !/ );
result[ 1 ].should.match( /\d !/ );
result[ 0 ].should.match( /\d \[INFO ] \(foo\) !/ );
result[ 1 ].should.match( /\d !/ );

@@ -119,5 +119,14 @@ log = require( "../lib/log.js" ).to( logStream );

result.length.should.equal( 4 );
result[ 2 ].should.match( /\d \[INFO ] !/ );
result[ 3 ].should.match( /\d !/ );
result[ 2 ].should.match( /\d \[INFO ] !/ );
result[ 3 ].should.match( /\d !/ );
} );
it( "should expand prefix padding", () => {
log = require( "../lib/log.js" ).module( "module" ).to( logStream );
log.info( "!" );
log = require( "../lib/log.js" ).module( "foo" ).to( logStream );
log.info( "!" );
result.length.should.equal( 2 );
result[ 0 ].should.match( /\d \[INFO ] \(module\) !/ );
result[ 1 ].should.match( /\d \[INFO ] \( foo\) !/ );
} );
} );

@@ -124,0 +133,0 @@

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