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 => __guard__(window.location != null ? window.location.search : undefined, x =>
x.match(/debug=true/) x.match(/debug=true/)
) != null ) != null
var sl_console_last_log = null
window.sl_console = { window.sl_console = {
log(...args) { log(...args) {
if (sl_debugging) { 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 || [])) return console.log(...Array.from(args || []))
} }
} }

View file

@ -346,7 +346,7 @@ define([
if (inflightOp == null && pendingOp == null) { if (inflightOp == null && pendingOp == null) {
// there's nothing going on, this is ok. // there's nothing going on, this is ok.
saved = true 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) { } else if (inflightOp != null && inflightOp === this.oldInflightOp) {
// The same inflight op has been sitting unacked since we // The same inflight op has been sitting unacked since we
// last checked, this is bad. // last checked, this is bad.

View file

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

View file

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