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 1.1.1 to 2.0.0

2

lib/index.d.ts

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

export declare const makeLogger: (options?: ILoggerOptions) => ILogger;
export declare const wipeSensitiveHeaders: (meta: any) => any;
export declare const wipeSensitiveData: (meta: any) => any;
'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
var winston = require('winston')
var environment = (typeof process !== 'undefined' && process.env.NODE_ENV) || 'development'
var util_1 = require('util')
var winston_1 = require('winston')
var environment =
(typeof process !== 'undefined' && process.env.NODE_ENV && process.env.NODE_ENV.trim()) ||
'development'
var isDevelopment = environment === 'development'
var customFormat = isDevelopment
? winston_1.format.combine(
winston_1.format.metadata(),
winston_1.format.timestamp(),
winston_1.format.colorize(),
// format.prettyPrint()
winston_1.format.printf(function(info) {
var str = '[' + info.timestamp + '] ' + info.level + ': ' + info.message
if (info.metadata && Object.keys(info.metadata).length > 0) {
str += '\n' + util_1.inspect(info.metadata, false, null, true)
}
return str
})
)
: winston_1.format.combine(winston_1.format.timestamp(), winston_1.format.logstash())
exports.makeLogger = function(options) {

@@ -14,23 +32,14 @@ if (options === void 0) {

: defaultOptions.wipeSensitiveData
return new winston.Logger({
var wipeSensitiveDataFormat = winston_1.format(function(meta) {
return options.wipeSensitiveData(meta)
})
return winston_1.createLogger({
level: options.logLevel,
exitOnError: false,
handleExceptions: true,
rewriters: [
function(level, msg, meta) {
if (meta) {
return options.wipeSensitiveData(meta)
}
return meta
}
],
format: isDevelopment
? customFormat
: winston_1.format.combine(wipeSensitiveDataFormat(), customFormat),
transports: [
new winston.transports.Console({
colorize: true,
humanReadableUnhandledException: isDevelopment,
json: !isDevelopment,
level: options.logLevel,
logstash: !isDevelopment,
prettyPrint: isDevelopment,
stringify: !isDevelopment,
timestamp: true
new winston_1.transports.Console({
handleExceptions: true
})

@@ -40,12 +49,6 @@ ]

}
exports.wipeSensitiveHeaders = function(meta) {
var request = meta.req
if (!request || !request.headers || isDevelopment) {
return meta
}
delete request.headers.authorization
delete request.headers.cookie
exports.wipeSensitiveData = function(meta) {
return meta
}
var defaultOptions = { logLevel: 'debug', wipeSensitiveData: exports.wipeSensitiveHeaders }
var defaultOptions = { logLevel: 'debug', wipeSensitiveData: exports.wipeSensitiveData }
//# sourceMappingURL=index.js.map
{
"name": "loggerism",
"version": "1.1.1",
"version": "2.0.0",
"description": "Yet another logger abstraction",

@@ -24,12 +24,12 @@ "main": "lib/index.js",

"dependencies": {
"winston": "^2.4.2"
"winston": "^3.1.0"
},
"devDependencies": {
"@types/winston": "^2.3.9",
"@types/node": "^10.11.5",
"precommit-hook": "^3.0.0",
"prettier": "^1.12.1",
"prettier": "^1.14.3",
"rimraf": "^2.6.2",
"tslint": "^5.10.0",
"tslint-config-prettier": "^1.13.0",
"typescript": "^2.8.3"
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"typescript": "^3.1.1"
},

@@ -36,0 +36,0 @@ "files": [

@@ -5,2 +5,2 @@ # Yet another logger abstraction

Currently use [winston 2](https://github.com/winstonjs/winston) for default implementation but this is likely to be changed to more productive loggers like [pino](https://github.com/pinojs/pino) or [winson 3](https://github.com/winstonjs/winston).
Currently use [winston 3](https://github.com/winstonjs/winston) for default implementation but this is likely to be changed to more productive loggers like [pino](https://github.com/pinojs/pino).

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