Skip to content

Commit

Permalink
Feat/reduce bundle size (#28)
Browse files Browse the repository at this point in the history
* import just used methods to reduce bundle size
  • Loading branch information
thiagoazeredo-quintoandar authored Mar 16, 2023
1 parent 9d6c7d0 commit ce87212
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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()}`,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/transports.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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',
Expand All @@ -28,7 +28,7 @@ class SentryTransport extends Transport {
},
});

super(_.omit(options, [
super(omit(options, [
'levelsMap',
]));

Expand Down

0 comments on commit ce87212

Please sign in to comment.