screwdriver-api 8.0.16 → 8.0.17
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/config/default.yaml
CHANGED
|
@@ -385,6 +385,9 @@ log:
|
|
|
385
385
|
enabled: false
|
|
386
386
|
# add target scope tokens(pipeline, build, temporal, admin, guest, user)
|
|
387
387
|
scope: []
|
|
388
|
+
payload:
|
|
389
|
+
# set true to enable payload logs for all API calls over 5s
|
|
390
|
+
enabled: true
|
|
388
391
|
|
|
389
392
|
# default cluster environment variables to inject into builds
|
|
390
393
|
build:
|
package/lib/server.js
CHANGED
|
@@ -15,7 +15,7 @@ process.on('unhandledRejection', (reason, p) => {
|
|
|
15
15
|
*/
|
|
16
16
|
function handlePreResponseLogs(request, h) {
|
|
17
17
|
const { response } = request;
|
|
18
|
-
const { release } = request.server.app;
|
|
18
|
+
const { release, log } = request.server.app;
|
|
19
19
|
|
|
20
20
|
if (release && release.cookieName && request.state && !request.state[release.cookieName]) {
|
|
21
21
|
h.state(release.cookieName, release.cookieValue);
|
|
@@ -49,7 +49,15 @@ function handlePreResponseLogs(request, h) {
|
|
|
49
49
|
|
|
50
50
|
// Log request payload when it takes longer than 5 seconds to respond
|
|
51
51
|
// This is to prevent logging payloads for every request
|
|
52
|
-
if (
|
|
52
|
+
if (
|
|
53
|
+
log &&
|
|
54
|
+
log.payload &&
|
|
55
|
+
log.payload.enabled &&
|
|
56
|
+
request.info &&
|
|
57
|
+
request.info.received &&
|
|
58
|
+
Date.now() - request.info.received > 5000 &&
|
|
59
|
+
request.payload
|
|
60
|
+
) {
|
|
53
61
|
request.log(['payload'], {
|
|
54
62
|
method: request.method,
|
|
55
63
|
path: request.path,
|
|
@@ -161,7 +169,8 @@ module.exports = async config => {
|
|
|
161
169
|
ecosystem: config.ecosystem,
|
|
162
170
|
release: config.release,
|
|
163
171
|
queueWebhook: config.queueWebhook,
|
|
164
|
-
unzipArtifacts: config.unzipArtifactsEnabled
|
|
172
|
+
unzipArtifacts: config.unzipArtifactsEnabled,
|
|
173
|
+
log: config.log
|
|
165
174
|
};
|
|
166
175
|
|
|
167
176
|
const bellConfigs = await config.auth.scm.getBellConfiguration();
|