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

loggerism

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loggerism - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

1

lib/index.d.ts

@@ -13,2 +13,3 @@ export declare type LogMethod = (msg: string | Error, meta?: object | Error) => ILogger;

export declare const makeLogger: (options?: ILoggerOptions) => ILogger;
export declare const wrapLogger: <T extends object = object>(logger: ILogger, baseMeta: T) => ILogger;
export declare const wipeSensitiveData: (meta: any) => any;

@@ -24,12 +24,12 @@ 'use strict'

var isDevelopment = environment === 'development'
var getMetaFromError = function(e) {
return __assign({ level: 'error', message: e.message, callstack: e.stack }, e)
}
var errorFormat = winston_1.format(function(info) {
if (info instanceof Error) {
return __assign({ message: info.message, callstack: info.stack }, info)
return getMetaFromError(info)
}
if (info && info.message instanceof Error) {
var err = info.message
return __assign(
{ message: info.message ? info.message : err.message, callstack: err.stack },
info
)
return __assign({}, getMetaFromError(err), info)
}

@@ -42,6 +42,3 @@ if (

var err = info[triple_beam_1.SPLAT][0]
return __assign(
{ message: info.message ? info.message : err.message, callstack: err.stack },
info
)
return __assign({}, getMetaFromError(err), info)
}

@@ -94,2 +91,43 @@ return info

}
exports.wrapLogger = function(logger, baseMeta) {
var log = function(level, msg, meta) {
if (msg instanceof Error && !meta) {
var error = msg
logger[level](error.message, __assign({}, getMetaFromError(error), baseMeta))
return wrappedLogger
}
// just a strange case
if (msg instanceof Error && meta instanceof Error) {
var error1 = msg
var error2 = meta
logger[level](
error1.message,
__assign({}, getMetaFromError(error1), getMetaFromError(error2), baseMeta)
)
return wrappedLogger
}
if (meta && meta instanceof Error) {
var error = meta
logger[level](msg ? msg : error.message, __assign({}, getMetaFromError(error), baseMeta))
return wrappedLogger
}
logger[level](msg, meta ? __assign({}, meta, baseMeta) : baseMeta)
return wrappedLogger
}
var wrappedLogger = {
error: function(msg, meta) {
return log('error', msg, meta)
},
warn: function(msg, meta) {
return log('warn', msg, meta)
},
info: function(msg, meta) {
return log('info', msg, meta)
},
debug: function(msg, meta) {
return log('debug', msg, meta)
}
}
return wrappedLogger
}
exports.wipeSensitiveData = function(meta) {

@@ -96,0 +134,0 @@ return meta

2

package.json
{
"name": "loggerism",
"version": "2.1.0",
"version": "2.2.0",
"description": "Yet another logger abstraction",

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

Sorry, the diff of this file is not supported yet

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