more logging

This commit is contained in:
azivner
2017-10-24 22:17:48 -04:00
parent b4bb1b539e
commit 8e47e34d1f
5 changed files with 22 additions and 9 deletions

View File

@@ -2,6 +2,7 @@
const db = require('sqlite');
const utils = require('./utils');
const log = require('./log');
async function insert(table_name, rec) {
const columns = Object.keys(rec).join(", ");
@@ -55,6 +56,9 @@ async function addAudit(category, req=null, noteId=null, changeFrom=null, change
const browserId = req == null ? null : req.get('x-browser-id');
log.info("audit: " + category + ", browserId=" + browserId + ", noteId=" + noteId + ", from=" + changeFrom
+ ", to=" + changeTo + ", comment=" + comment);
await execute("INSERT INTO audit_log (date_modified, category, browser_id, note_id, change_from, change_to, comment)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?)", [now, category, browserId, noteId, changeFrom, changeTo, comment]);
}