diff --git a/package.json b/package.json index d190a46..eaa0c66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "quintoandar-logger", - "version": "3.3.7", + "version": "3.3.9", "description": "Winston logger with custom 5A configuration", "main": "src/main.js", "dependencies": { diff --git a/src/main.js b/src/main.js index b3e7252..f72c27c 100644 --- a/src/main.js +++ b/src/main.js @@ -1,6 +1,6 @@ const os = require('os'); -const util = require('util'); -const stackTrace = require('stack-trace'); +const { inspect } = require('util'); +const { get: getStackTrace } = require('stack-trace'); const Sentry = require('@sentry/node'); const { createLogger } = require('winston'); const { @@ -37,7 +37,7 @@ function getFunctionCaller(func) { } function getFunctionData(func) { - const trace = stackTrace.get(func || getFunctionCaller(getFunctionData)); + const trace = getStackTrace(func || getFunctionCaller(getFunctionData)); const callerData = trace[0]; const data = { filePath: `${callerData.getFileName()}:${callerData.getLineNumber()}:${callerData.getColumnNumber()}`, @@ -65,7 +65,7 @@ function formatParams(params, module, funcCallerParam) { result[0] = params[0].message; metadata.error = params[0]; } else { - result[0] = util.inspect(params[0], { + result[0] = inspect(params[0], { compact: prettyLogs, colors: prettyLogs, depth: null, diff --git a/src/transports.js b/src/transports.js index 3543ce6..8c30724 100644 --- a/src/transports.js +++ b/src/transports.js @@ -1,4 +1,4 @@ -const _ = require('lodash'); +const { defaultsDeep, omit } = require('lodash'); const Sentry = require('@sentry/node'); const { transports, format } = require('winston'); const Transport = require('winston-transport'); @@ -14,7 +14,7 @@ const escapeSequences = { class SentryTransport extends Transport { constructor(options) { options = options || {}; - options = _.defaultsDeep(options, { + options = defaultsDeep(options, { name: 'SentryTransport', silent: false, level: process.env.SENTRY_LOGGER_LEVEL || 'warn', @@ -28,7 +28,7 @@ class SentryTransport extends Transport { }, }); - super(_.omit(options, [ + super(omit(options, [ 'levelsMap', ]));