cleanup and revert adding Event stack trace

pull/2926/head
Isaac Connor 2020-04-10 11:14:46 -04:00
parent 54995ab0d1
commit 17896b656a
1 changed files with 28 additions and 27 deletions

View File

@ -53,12 +53,13 @@ function logReport( level, message, file, line ) {
/* eslint-enable no-caller */
if ( !debugReq ) {
debugParms = "view=request&request=log&task=create";
if ( Browser ) {
debugParms = "view=request&request=log&task=create&browser[name]="+Browser.name+"&browser[version]="+Browser.version+"&browser[platform]="+(Browser.Platform?Browser.Platform.name:'unknown');
debugParms += "&browser[name]="+Browser.name+"&browser[version]="+Browser.version+"&browser[platform]="+(Browser.Platform?Browser.Platform.name:'unknown');
} else {
debugParms = "view=request&request=log&task=create&browser[name]=unknown&browser[version]=unknown&browser[platform]=unknown";
debugParms += "&browser[name]=unknown&browser[version]=unknown&browser[platform]=unknown";
}
debugReq = new Request.JSON( {url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'chain'} );
debugReq = new Request.JSON({url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'chain'});
}
var requestParms = debugParms;
requestParms += "&level="+level+"&message="+encodeURIComponent(message);
@ -71,57 +72,57 @@ function logReport( level, message, file, line ) {
if ( line ) {
requestParms += "&line="+line;
}
debugReq.send( requestParms );
debugReq.send(requestParms);
}
function Panic( message ) {
console.error( message );
logReport( "PNC", message );
alert( "PANIC: "+message );
function Panic(message) {
console.error(message);
logReport("PNC", message);
alert("PANIC: "+message);
}
function Fatal( message ) {
console.error( message );
function Fatal(message) {
console.error(message);
logReport( "FAT", message );
alert( "FATAL: "+message );
}
function Error( message ) {
console.error( message );
logReport( "ERR", message );
function Error(message) {
console.error(message);
logReport("ERR", message);
}
function Warning( message ) {
console.warn( message );
logReport( "WAR", message );
function Warning(message) {
console.warn(message);
logReport("WAR", message);
}
function Info( message ) {
console.info( message );
logReport( "INF", message );
function Info(message) {
console.info(message);
logReport("INF", message);
}
function Debug( message ) {
console.debug( message );
//logReport( "DBG", message );
function Debug(message) {
console.debug(message);
//logReport("DBG", message);
}
function Dump( value, label ) {
function Dump(value, label) {
if ( label ) {
console.debug( label+" => " );
console.debug(label+" => ");
}
console.debug( value );
console.debug(value);
}
window.onerror =
function( message, url, line ) {
logReport( "ERR", message, url, line );
logReport("ERR", message, url, line);
};
window.addEventListener("securitypolicyviolation", function logCSP(evt) {
var level = evt.disposition == "enforce" ? "ERR" : "DBG";
var message = evt.blockedURI + " violated CSP " + evt.violatedDirective;
if (evt.sample) {
if ( evt.sample ) {
message += " (Sample: " + evt.sample + ")";
}
logReport(level, message, evt.sourceFile, evt.lineNumber);