Repository URL to install this package:
|
Version:
2.0.21 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//todo @anto this one needs to be moved to uxui-component library
const log = require('fliplog');
function fromReqResToDebug(req) {
const { protocol, secure, ip, ips, subdomains, path, hostname, host, xhr, body, cookies, method, params, query, route, signedCookies, originalUrl, url, baseUrl, locals, charset, headersSent, _header, headers, rawHeaders, data, statusCode, status, statusText, } = req;
const nonCircular = {
headers,
data,
statusCode,
status,
statusText,
_header,
protocol,
secure,
ip,
ips,
subdomains,
path,
hostname,
host,
xhr,
body,
cookies,
method,
params,
query,
route,
signedCookies,
originalUrl,
url,
baseUrl,
// res
headersSent,
locals,
charset,
};
return nonCircular;
}
exports.fromReqResToDebug = fromReqResToDebug;
function fromReqAndResToDebug(arg) {
const req = fromReqResToDebug(arg.req);
const res = fromReqResToDebug(arg.res);
return { req, res };
}
exports.fromReqAndResToDebug = fromReqAndResToDebug;
function fromReqAndOrResToDebug(arg) {
if (arg.req) {
return fromReqAndResToDebug(arg);
}
else {
return fromReqResToDebug(arg);
}
}
function logReqAndOrRes(arg) {
if (process.env.SHOULD_LOG_REQ_RES || true) {
const formatted = fromReqAndOrResToDebug(arg);
// const asString = JSON.stringify(formatted, undefined, 2)
log
.data(formatted)
.bold('[uxui-apis] request')
.echo();
}
}
exports.logReqAndOrRes = logReqAndOrRes;
//# sourceMappingURL=fromReqResToDebug.js.map