Merge pull request #1699 from sharelatex/bg-improve-logging

improve logging

GitOrigin-RevId: 0d87db74c62aa5c887412250c26f5acccdf73acf
This commit is contained in:
Brian Gough 2019-04-16 09:22:26 +01:00 committed by sharelatex
parent 0eaf6db2d6
commit d82f679fd7
4 changed files with 10 additions and 2 deletions

View file

@ -98,9 +98,17 @@ define([
__guard__(window.location != null ? window.location.search : undefined, x =>
x.match(/debug=true/)
) != null
var sl_console_last_log = null
window.sl_console = {
log(...args) {
if (sl_debugging) {
sl_console_last_log = null
return console.log(...Array.from(args || []))
}
},
logOnce(...args) {
if (sl_debugging && args[0] !== sl_console_last_log) {
sl_console_last_log = args[0]
return console.log(...Array.from(args || []))
}
}

View file

@ -346,7 +346,7 @@ define([
if (inflightOp == null && pendingOp == null) {
// there's nothing going on, this is ok.
saved = true
sl_console.log('[pollSavedStatus] no inflight or pending ops')
sl_console.logOnce('[pollSavedStatus] no inflight or pending ops')
} else if (inflightOp != null && inflightOp === this.oldInflightOp) {
// The same inflight op has been sitting unacked since we
// last checked, this is bad.

View file

@ -37,7 +37,6 @@ define(['base'], App =>
} else {
element.addClass('no-animate')
}
sl_console.log('LAYOUT')
if (scope.ui.reviewPanelOpen) {
PADDING = 8
TOOLBAR_HEIGHT = 38

View file

@ -36,6 +36,7 @@ define(['base'], function(App) {
if (meta == null) {
meta = {}
}
sl_console.log('event', type, meta)
this.recentEvents.push({ type, meta, date: new Date() })
if (this.recentEvents.length > 100) {
return this.recentEvents.shift()