Improve granularity and length of client side logs

This commit is contained in:
James Allen 2014-04-01 16:51:20 +01:00
parent 9f966996be
commit 0df412d241
3 changed files with 18 additions and 5 deletions

View file

@ -153,14 +153,22 @@ define [
@ide.pushEvent "remoteop",
doc_id: @doc_id
@trigger "remoteop"
@doc.on "op:sent", () =>
@doc.on "op:sent", (op) =>
@ide.pushEvent "op:sent",
doc_id: @doc_id
op: op
@trigger "op:sent"
@doc.on "op:acknowledged", () =>
@doc.on "op:acknowledged", (op) =>
@ide.pushEvent "op:acknowledged",
doc_id: @doc_id
op: op
@trigger "op:acknowledged"
@doc.on "flush", (inflightOp, pendingOp, version) =>
@ide.pushEvent "flush",
doc_id: @doc_id,
inflightOp: inflightOp,
pendingOp: pendingOp
v: version
_onError: (error, meta = {}) ->
console.error "ShareJS error", error, meta

View file

@ -109,11 +109,16 @@ define [
_bindToDocChanges: (doc) ->
submitOp = doc.submitOp
doc.submitOp = (args...) =>
@trigger "op:sent"
@trigger "op:sent", args...
doc.pendingCallbacks.push () =>
@trigger "op:acknowledged"
@trigger "op:acknowledged", args...
submitOp.apply(doc, args)
flush = doc.flush
doc.flush = (args...) =>
@trigger "flush", doc.inflightOp, doc.pendingOp, doc.version
flush.apply(doc, args)
_.extend(ShareJsDoc::, Backbone.Events)
return ShareJsDoc

View file

@ -165,7 +165,7 @@ define [
pushEvent: (type, meta = {}) ->
@recentEvents.push type: type, meta: meta, date: new Date()
if @recentEvents.length > 10
if @recentEvents.length > 40
@recentEvents.shift()
reportError: (error, meta = {}) ->