more robust logging logic to prevent errors
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
76de7ca451
commit
68022bb4e5
|
|
@ -115,9 +115,6 @@ class SynologyHttpClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
log_response(error, response, body, options) {
|
log_response(error, response, body, options) {
|
||||||
let prop;
|
|
||||||
let val;
|
|
||||||
|
|
||||||
const cleansedBody = JSON.parse(stringify(body));
|
const cleansedBody = JSON.parse(stringify(body));
|
||||||
const cleansedOptions = JSON.parse(stringify(options));
|
const cleansedOptions = JSON.parse(stringify(options));
|
||||||
// This function handles arrays and objects
|
// This function handles arrays and objects
|
||||||
|
|
@ -154,8 +151,12 @@ class SynologyHttpClient {
|
||||||
|
|
||||||
this.logger.debug("SYNOLOGY HTTP REQUEST: " + stringify(cleansedOptions));
|
this.logger.debug("SYNOLOGY HTTP REQUEST: " + stringify(cleansedOptions));
|
||||||
this.logger.debug("SYNOLOGY HTTP ERROR: " + error);
|
this.logger.debug("SYNOLOGY HTTP ERROR: " + error);
|
||||||
this.logger.debug("SYNOLOGY HTTP STATUS: " + response.statusCode);
|
this.logger.debug(
|
||||||
this.logger.debug("SYNOLOGY HTTP HEADERS: " + stringify(response.headers));
|
"SYNOLOGY HTTP STATUS: " + _.get(response, "statusCode", "")
|
||||||
|
);
|
||||||
|
this.logger.debug(
|
||||||
|
"SYNOLOGY HTTP HEADERS: " + stringify(_.get(response, "headers", ""))
|
||||||
|
);
|
||||||
this.logger.debug("SYNOLOGY HTTP BODY: " + stringify(cleansedBody));
|
this.logger.debug("SYNOLOGY HTTP BODY: " + stringify(cleansedBody));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,8 +127,12 @@ class Client {
|
||||||
|
|
||||||
this.logger.debug("FREENAS HTTP REQUEST: " + stringify(options));
|
this.logger.debug("FREENAS HTTP REQUEST: " + stringify(options));
|
||||||
this.logger.debug("FREENAS HTTP ERROR: " + error);
|
this.logger.debug("FREENAS HTTP ERROR: " + error);
|
||||||
this.logger.debug("FREENAS HTTP STATUS: " + response.statusCode);
|
this.logger.debug(
|
||||||
this.logger.debug("FREENAS HTTP HEADERS: " + stringify(response.headers));
|
"FREENAS HTTP STATUS: " + _.get(response, "statusCode", "")
|
||||||
|
);
|
||||||
|
this.logger.debug(
|
||||||
|
"FREENAS HTTP HEADERS: " + stringify(_.get(response, "headers", ""))
|
||||||
|
);
|
||||||
this.logger.debug("FREENAS HTTP BODY: " + stringify(body));
|
this.logger.debug("FREENAS HTTP BODY: " + stringify(body));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue