Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hubermat committed May 26, 2020
1 parent dba5181 commit 99416da
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ctldap.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ function logWarn(site, msg) {

function logError(site, msg, error) {
console.log("[ERROR] "+site.sitename+" - "+msg);
console.log(error.stack);
if (error) {
console.log(error);
}
}

if (config.debug) {
Expand Down Expand Up @@ -256,8 +258,9 @@ function apiPost(site, func, data, triedLogin, triedCSRFUpdate) {
return apiPost(site, func, data, true, triedCSRFUpdate);
});
} else {
logError(site, "CT API request still not working after login:");
throw new Error(JSON.stringify(result));
var error = new Error(JSON.stringify(result);
logError(site, "CT API request still not working after login: ", error);
throw error;
}
}
return result.data;
Expand Down Expand Up @@ -505,7 +508,7 @@ function authenticate (req, res, next) {
return;
}
} else {
logDebug(site, "Bind user DN: %s", req.dn);
logDebug(site, "Bind user DN: " + req.dn);
}
apiPost(site, "authenticate", {
"user": req.dn.rdns[0].attrs.cn.value,
Expand Down

0 comments on commit 99416da

Please sign in to comment.