-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlogging.js
More file actions
26 lines (24 loc) · 776 Bytes
/
logging.js
File metadata and controls
26 lines (24 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// May want to use Truk ID if we can get it
var userID = Math.floor(Math.random() * (100000000)).toString();
function logQuery(type, data) {
var sendData = {
"userId": userID,
"type": type,
"data": data,
"time": new Date().toString()
};
$.ajax({
url: baseURL + '/logging',
async: true,
type: 'POST',
data: JSON.stringify(sendData),
dataType: 'text',
contentType: 'text/plain',
error: (function(type){
return function(jqXHR, status, error) {
// Not much use in trying to inform the user
console.error('ERROR: ' + error + '(Status ' + status + ') - Unable to log query ' + type);
};
})(type)
});
}