671f8e4fac56f9dcd5497c1e45e7cda89d98cceb chmalee Wed Apr 19 14:45:03 2023 -0700 Adding an asynchronous logging function for the javascript diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 8421096..3cdbd11 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -5481,30 +5481,31 @@ newLink.textContent = "Download Current Track Data"; newLink.href = "#"; newListEl.appendChild(newLink); $("#downloads > ul")[0].appendChild(newListEl); $("#hgTracksDownload").click(downloadCurrentTrackData.showDownloadUi); } }); function hgtWarnTiming(maxSeconds) { /* show a dialog box if the page load time was slower than x seconds. Has buttons to hide or never show this again. */ var loadTime = window.performance.timing.domContentLoadedEventStart-window.performance.timing.navigationStart; /// in msecs var loadSeconds = loadTime/1000; var skipNotification = localStorage.getItem("hgTracks.hideSpeedNotification"); if (loadSeconds > maxSeconds && !skipNotification) { + writeToApacheLog("load time: " + loadSeconds + "s, showing warning message"); var div = document.createElement("div"); div.style.display = "none"; div.style.width = "90%"; div.style.marginLeft = "100px"; div.id = "notifBox"; div.innerHTML = "This page took "+loadSeconds+" seconds to load. We strive to keep "+ "the UCSC Genome Browser quick and responsive. See our "+ "<b><a href='../FAQ/FAQtracks.html#speed' target='_blank'>display speed FAQ</a></b> for "+ "common causes and solutions to slow performance. If this problem continues, you can create a "+ "session link via <b>My Data</b> > <b>My Sessions</b> and send the link to <b>genome-www@soe.ucsc.edu</b>.<br>"+ "<div style='text-align:center'>"+ "<button id='notifyHide'>Close</button> "+ "<button id='notifyHideForever'>Don't show again</button>"+ "</div>"; document.body.appendChild(div);