Skip to content

Instantly share code, notes, and snippets.

@majest
Created June 18, 2015 10:44
Show Gist options
  • Save majest/70b2106669bfdb6a5b95 to your computer and use it in GitHub Desktop.
Save majest/70b2106669bfdb6a5b95 to your computer and use it in GitHub Desktop.
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