async logging of info messages

This commit is contained in:
azivner 2018-04-07 21:30:01 -04:00
parent b5e6f46b9c
commit b09463d1b2

View File

@ -15,14 +15,22 @@ const logger = require('simple-node-logger').createRollingFileLogger({
}); });
function info(message) { function info(message) {
logger.info(message); // info messages are logged asynchronously
setTimeout(() => {
console.log(message);
console.log(message); logger.info(message);
}, 0);
} }
function error(message) { function error(message) {
message = "ERROR: " + message;
// we're using .info() instead of .error() because simple-node-logger emits weird error for showError() // we're using .info() instead of .error() because simple-node-logger emits weird error for showError()
info("ERROR: " + message); // errors are logged synchronously to make sure it doesn't get lost in case of crash
logger.info(message);
console.trace(message);
} }
const requestBlacklist = [ "/libraries", "/javascripts", "/images", "/stylesheets" ]; const requestBlacklist = [ "/libraries", "/javascripts", "/images", "/stylesheets" ];