Skip to content

Commit ce87212

Browse files
Feat/reduce bundle size (#28)
* import just used methods to reduce bundle size
1 parent 9d6c7d0 commit ce87212

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quintoandar-logger",
3-
"version": "3.3.7",
3+
"version": "3.3.9",
44
"description": "Winston logger with custom 5A configuration",
55
"main": "src/main.js",
66
"dependencies": {

src/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const os = require('os');
2-
const util = require('util');
3-
const stackTrace = require('stack-trace');
2+
const { inspect } = require('util');
3+
const { get: getStackTrace } = require('stack-trace');
44
const Sentry = require('@sentry/node');
55
const { createLogger } = require('winston');
66
const {
@@ -37,7 +37,7 @@ function getFunctionCaller(func) {
3737
}
3838

3939
function getFunctionData(func) {
40-
const trace = stackTrace.get(func || getFunctionCaller(getFunctionData));
40+
const trace = getStackTrace(func || getFunctionCaller(getFunctionData));
4141
const callerData = trace[0];
4242
const data = {
4343
filePath: `${callerData.getFileName()}:${callerData.getLineNumber()}:${callerData.getColumnNumber()}`,
@@ -65,7 +65,7 @@ function formatParams(params, module, funcCallerParam) {
6565
result[0] = params[0].message;
6666
metadata.error = params[0];
6767
} else {
68-
result[0] = util.inspect(params[0], {
68+
result[0] = inspect(params[0], {
6969
compact: prettyLogs,
7070
colors: prettyLogs,
7171
depth: null,

src/transports.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const _ = require('lodash');
1+
const { defaultsDeep, omit } = require('lodash');
22
const Sentry = require('@sentry/node');
33
const { transports, format } = require('winston');
44
const Transport = require('winston-transport');
@@ -14,7 +14,7 @@ const escapeSequences = {
1414
class SentryTransport extends Transport {
1515
constructor(options) {
1616
options = options || {};
17-
options = _.defaultsDeep(options, {
17+
options = defaultsDeep(options, {
1818
name: 'SentryTransport',
1919
silent: false,
2020
level: process.env.SENTRY_LOGGER_LEVEL || 'warn',
@@ -28,7 +28,7 @@ class SentryTransport extends Transport {
2828
},
2929
});
3030

31-
super(_.omit(options, [
31+
super(omit(options, [
3232
'levelsMap',
3333
]));
3434

0 commit comments

Comments
 (0)