Skip to content

Commit b8b7b95

Browse files
committed
fix(package): remove lodash as a dependency
1 parent ba2ab12 commit b8b7b95

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"chalk": "2.3.0",
4141
"cls-hooked": "4.2.2",
4242
"event-stream": "3.3.4",
43-
"lodash": "4.17.4",
4443
"uuid": "3.1.0"
4544
},
4645
"devDependencies": {

src/logger/logger.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,34 @@
22

33
const config = require('../config');
44
const continuationLocalStorage = require('cls-hooked');
5-
const _ = require('lodash');
65
const STACK_TRACE_LIMIT = 4000;
76
const Timer = require('../timer/timer');
87

8+
const getContextStorage = function() {
9+
const contextNamespace = continuationLocalStorage.getNamespace('session');
10+
11+
if (contextNamespace && contextNamespace.active) {
12+
const { id, _ns_name, ...contextData } = contextNamespace.active;
13+
return contextData;
14+
}
15+
16+
return {};
17+
};
18+
919
const logMethodFactory = function(level) {
1020
return function(action, data) {
1121
if (!this._enabled) {
1222
return;
1323
}
1424

15-
const contextNamespace = continuationLocalStorage.getNamespace('session');
16-
const contextStorage = (contextNamespace && contextNamespace.active) ?
17-
_.omit(contextNamespace.active, 'id', '_ns_name') : {};
18-
1925
console.log(JSON.stringify(Object.assign(
2026
{
2127
name: this._namespace,
2228
action: action,
2329
level: config.levels[level].number,
2430
time: new Date().toISOString()
2531
},
26-
contextStorage,
32+
getContextStorage(),
2733
data
2834
)));
2935
}

0 commit comments

Comments
 (0)