diff --git a/scripts/logserver.js b/scripts/logserver.js index f54c2d8d1bc..18989879fac 100644 --- a/scripts/logserver.js +++ b/scripts/logserver.js @@ -3,6 +3,13 @@ // env HADRON_METRICS_SEGMENT_API_KEY='ignore' HADRON_METRICS_SEGMENT_HOST='http://localhost:8000' npm start const http = require('http'); +function write(payload) { + if (process.stdout.isTTY) { + console.dir(payload, { depth: Infinity }); + } else { + process.stdout.write(JSON.stringify(payload) + '\n'); + } +} http .createServer((req, res) => { let body = ''; @@ -17,7 +24,8 @@ http } catch { // } - console.dir({ headers: req.headers, body }, { depth: Infinity }); + + write({ headers: req.headers, body }); res.writeHead(200); res.end('Ok\n'); });