Created
June 18, 2015 10:44
-
-
Save majest/70b2106669bfdb6a5b95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.saveLog = function (userId, title, request, response, errors, type) { | |
var log = { userId: userId, title: title, status: 'ok', type: type }; | |
log.details = { request: request, response: response }; | |
if (errors != null && errors.length !== 0) { | |
log.details.response = errors; | |
log.type = type + '_error'; | |
log.status = 'error'; | |
} | |
var logging = new Logging(log); | |
logging.save(function(err) { | |
if (err) { | |
console.log('Could not save log'); | |
console.log(err); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment