@jaypie/express 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.cjs +10 -7
- package/dist/module.esm.js +10 -7
- package/package.json +1 -1
- package/src/expressHandler.js +10 -7
package/dist/module.cjs
CHANGED
|
@@ -192,18 +192,21 @@ const expressHandler = (
|
|
|
192
192
|
|
|
193
193
|
// Re-init the logger
|
|
194
194
|
core.log.init();
|
|
195
|
+
// Very low-level, internal sub-trace details
|
|
196
|
+
const libLogger = core.log.lib({
|
|
197
|
+
lib: core.JAYPIE.LIB.EXPRESS,
|
|
198
|
+
});
|
|
195
199
|
|
|
196
200
|
// Update the public logger with the request ID
|
|
197
201
|
const invokeUuid = getCurrentInvokeUuid();
|
|
198
202
|
if (invokeUuid) {
|
|
199
203
|
core.log.tag({ invoke: invokeUuid });
|
|
200
204
|
core.log.tag({ shortInvoke: invokeUuid.slice(0, 8) });
|
|
205
|
+
// TODO: in theory this is redundant
|
|
206
|
+
libLogger.tag({ invoke: invokeUuid });
|
|
207
|
+
libLogger.tag({ shortInvoke: invokeUuid.slice(0, 8) });
|
|
201
208
|
}
|
|
202
209
|
|
|
203
|
-
// Very low-level, internal sub-trace details
|
|
204
|
-
const libLogger = core.log.lib({
|
|
205
|
-
lib: core.JAYPIE.LIB.EXPRESS,
|
|
206
|
-
});
|
|
207
210
|
libLogger.trace("[jaypie] Express init");
|
|
208
211
|
|
|
209
212
|
// Top-level, important details that run at the same level as the main logger
|
|
@@ -268,15 +271,15 @@ const expressHandler = (
|
|
|
268
271
|
// Locals
|
|
269
272
|
const keys = Object.keys(locals);
|
|
270
273
|
if (keys.length > 0) {
|
|
271
|
-
const localsSetup = async () => {
|
|
274
|
+
const localsSetup = async (localsReq, localsRes) => {
|
|
272
275
|
for (let i = 0; i < keys.length; i += 1) {
|
|
273
276
|
const key = keys[i];
|
|
274
277
|
libLogger.trace(`[jaypie] Locals: ${key}`);
|
|
275
278
|
if (typeof locals[key] === "function") {
|
|
276
279
|
// eslint-disable-next-line no-await-in-loop
|
|
277
|
-
|
|
280
|
+
localsReq.locals[key] = await locals[key](localsReq, localsRes);
|
|
278
281
|
} else {
|
|
279
|
-
|
|
282
|
+
localsReq.locals[key] = locals[key];
|
|
280
283
|
}
|
|
281
284
|
}
|
|
282
285
|
};
|
package/dist/module.esm.js
CHANGED
|
@@ -190,18 +190,21 @@ const expressHandler = (
|
|
|
190
190
|
|
|
191
191
|
// Re-init the logger
|
|
192
192
|
log.init();
|
|
193
|
+
// Very low-level, internal sub-trace details
|
|
194
|
+
const libLogger = log.lib({
|
|
195
|
+
lib: JAYPIE.LIB.EXPRESS,
|
|
196
|
+
});
|
|
193
197
|
|
|
194
198
|
// Update the public logger with the request ID
|
|
195
199
|
const invokeUuid = getCurrentInvokeUuid();
|
|
196
200
|
if (invokeUuid) {
|
|
197
201
|
log.tag({ invoke: invokeUuid });
|
|
198
202
|
log.tag({ shortInvoke: invokeUuid.slice(0, 8) });
|
|
203
|
+
// TODO: in theory this is redundant
|
|
204
|
+
libLogger.tag({ invoke: invokeUuid });
|
|
205
|
+
libLogger.tag({ shortInvoke: invokeUuid.slice(0, 8) });
|
|
199
206
|
}
|
|
200
207
|
|
|
201
|
-
// Very low-level, internal sub-trace details
|
|
202
|
-
const libLogger = log.lib({
|
|
203
|
-
lib: JAYPIE.LIB.EXPRESS,
|
|
204
|
-
});
|
|
205
208
|
libLogger.trace("[jaypie] Express init");
|
|
206
209
|
|
|
207
210
|
// Top-level, important details that run at the same level as the main logger
|
|
@@ -266,15 +269,15 @@ const expressHandler = (
|
|
|
266
269
|
// Locals
|
|
267
270
|
const keys = Object.keys(locals);
|
|
268
271
|
if (keys.length > 0) {
|
|
269
|
-
const localsSetup = async () => {
|
|
272
|
+
const localsSetup = async (localsReq, localsRes) => {
|
|
270
273
|
for (let i = 0; i < keys.length; i += 1) {
|
|
271
274
|
const key = keys[i];
|
|
272
275
|
libLogger.trace(`[jaypie] Locals: ${key}`);
|
|
273
276
|
if (typeof locals[key] === "function") {
|
|
274
277
|
// eslint-disable-next-line no-await-in-loop
|
|
275
|
-
|
|
278
|
+
localsReq.locals[key] = await locals[key](localsReq, localsRes);
|
|
276
279
|
} else {
|
|
277
|
-
|
|
280
|
+
localsReq.locals[key] = locals[key];
|
|
278
281
|
}
|
|
279
282
|
}
|
|
280
283
|
};
|
package/package.json
CHANGED
package/src/expressHandler.js
CHANGED
|
@@ -43,18 +43,21 @@ const expressHandler = (
|
|
|
43
43
|
|
|
44
44
|
// Re-init the logger
|
|
45
45
|
publicLogger.init();
|
|
46
|
+
// Very low-level, internal sub-trace details
|
|
47
|
+
const libLogger = publicLogger.lib({
|
|
48
|
+
lib: JAYPIE.LIB.EXPRESS,
|
|
49
|
+
});
|
|
46
50
|
|
|
47
51
|
// Update the public logger with the request ID
|
|
48
52
|
const invokeUuid = getCurrentInvokeUuid();
|
|
49
53
|
if (invokeUuid) {
|
|
50
54
|
publicLogger.tag({ invoke: invokeUuid });
|
|
51
55
|
publicLogger.tag({ shortInvoke: invokeUuid.slice(0, 8) });
|
|
56
|
+
// TODO: in theory this is redundant
|
|
57
|
+
libLogger.tag({ invoke: invokeUuid });
|
|
58
|
+
libLogger.tag({ shortInvoke: invokeUuid.slice(0, 8) });
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
// Very low-level, internal sub-trace details
|
|
55
|
-
const libLogger = publicLogger.lib({
|
|
56
|
-
lib: JAYPIE.LIB.EXPRESS,
|
|
57
|
-
});
|
|
58
61
|
libLogger.trace("[jaypie] Express init");
|
|
59
62
|
|
|
60
63
|
// Top-level, important details that run at the same level as the main logger
|
|
@@ -119,15 +122,15 @@ const expressHandler = (
|
|
|
119
122
|
// Locals
|
|
120
123
|
const keys = Object.keys(locals);
|
|
121
124
|
if (keys.length > 0) {
|
|
122
|
-
const localsSetup = async () => {
|
|
125
|
+
const localsSetup = async (localsReq, localsRes) => {
|
|
123
126
|
for (let i = 0; i < keys.length; i += 1) {
|
|
124
127
|
const key = keys[i];
|
|
125
128
|
libLogger.trace(`[jaypie] Locals: ${key}`);
|
|
126
129
|
if (typeof locals[key] === "function") {
|
|
127
130
|
// eslint-disable-next-line no-await-in-loop
|
|
128
|
-
|
|
131
|
+
localsReq.locals[key] = await locals[key](localsReq, localsRes);
|
|
129
132
|
} else {
|
|
130
|
-
|
|
133
|
+
localsReq.locals[key] = locals[key];
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
136
|
};
|