mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add in debugging console.logs which only display if ?debug=true is in URL
This commit is contained in:
parent
41f789a313
commit
0175a86d4c
4 changed files with 13 additions and 4 deletions
|
@ -24,4 +24,8 @@ define [
|
|||
client_id: window.user_id
|
||||
})
|
||||
|
||||
sl_debugging = window.location?.search?.match(/debug=true/)?
|
||||
window.sl_console =
|
||||
log: (args...) -> console.log(args...) if sl_debugging
|
||||
|
||||
return App
|
||||
|
|
|
@ -61,6 +61,8 @@ define [], () ->
|
|||
if @$scope.state.loading
|
||||
@$scope.state.load_progress = 70
|
||||
|
||||
sl_console.log "[socket.io connect] Connected"
|
||||
|
||||
setTimeout(() =>
|
||||
@joinProject()
|
||||
, 100)
|
||||
|
@ -97,6 +99,7 @@ define [], () ->
|
|||
, 10 * 1000
|
||||
|
||||
joinProject: () ->
|
||||
sl_console.log "[joinProject] joining..."
|
||||
@ide.socket.emit 'joinProject', {
|
||||
project_id: @ide.project_id
|
||||
}, (err, project, permissionsLevel, protocolVersion) =>
|
||||
|
|
|
@ -172,14 +172,14 @@ define [
|
|||
update: update
|
||||
|
||||
if window.disconnectOnAck? and Math.random() < window.disconnectOnAck
|
||||
console.log "Disconnecting on ack", update
|
||||
sl_console.log "Disconnecting on ack", update
|
||||
window._ide.socket.socket.disconnect()
|
||||
# Pretend we never received the ack
|
||||
return
|
||||
|
||||
if window.dropAcks? and Math.random() < window.dropAcks
|
||||
if !update.op? # Only drop our own acks, not collaborator updates
|
||||
console.log "Simulating a lost ack", update
|
||||
sl_console.log "Simulating a lost ack", update
|
||||
return
|
||||
|
||||
if update?.doc == @doc_id and @doc?
|
||||
|
@ -194,6 +194,7 @@ define [
|
|||
@doc?.updateConnectionState "disconnected"
|
||||
|
||||
_onReconnect: () ->
|
||||
sl_console.log "[onReconnect] reconnected (joined project)"
|
||||
@ide.pushEvent "reconnected:afterJoinProject"
|
||||
|
||||
@connected = true
|
||||
|
|
|
@ -29,10 +29,10 @@ define [
|
|||
send: (update) =>
|
||||
@_startInflightOpTimeout(update)
|
||||
if window.disconnectOnUpdate? and Math.random() < window.disconnectOnUpdate
|
||||
console.log "Disconnecting on update", update
|
||||
sl_console.log "Disconnecting on update", update
|
||||
window._ide.socket.socket.disconnect()
|
||||
if window.dropUpdates? and Math.random() < window.dropUpdates
|
||||
console.log "Simulating a lost update", update
|
||||
sl_console.log "Simulating a lost update", update
|
||||
return
|
||||
@socket.emit "applyOtUpdate", @doc_id, update
|
||||
state: "ok"
|
||||
|
@ -95,6 +95,7 @@ define [
|
|||
@_doc.flush()
|
||||
|
||||
updateConnectionState: (state) ->
|
||||
sl_console.log "[updateConnectionState] Setting state to #{state}"
|
||||
@connection.state = state
|
||||
@connection.id = @socket.socket.sessionid
|
||||
@_doc.autoOpen = false
|
||||
|
|
Loading…
Reference in a new issue