@thebosco/the-bosco-server-logger
Advanced tools
Comparing version 1.0.4 to 1.0.5
21
index.js
@@ -5,7 +5,26 @@ 'use strict' | ||
const moment = require('moment') | ||
const LEVEL = Symbol.for('level') | ||
class Logger { | ||
constructor({papertrailHostname, defaultLevel, format, levels, colors} = {}) { | ||
constructor({ | ||
papertrailHostname, | ||
defaultLevel, | ||
format, | ||
levels, | ||
colors, | ||
excludedLevels = [] | ||
} = {}) { | ||
defaultLevel = defaultLevel || 'debug' | ||
/** | ||
* Log only the messages the match `level`. | ||
*/ | ||
function filterOnly() { | ||
return winston.format(function (info) { | ||
if (!excludedLevels.includes(info[LEVEL])) { | ||
return info | ||
} | ||
})() | ||
} | ||
this.format = format || winston.format.combine( | ||
filterOnly(), | ||
winston.format.colorize({message: true, levels: true}), | ||
@@ -12,0 +31,0 @@ winston.format.timestamp(), |
{ | ||
"name": "@thebosco/the-bosco-server-logger", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Server-side logging package", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
7687
146
1