# HG changeset patch # User drewp@bigasterisk.com # Date 2023-05-29 22:18:04 # Node ID f61531e21a77cfece7ad3875e4a5ebd8988cf460 # Parent 1b7cde922c3db3b8595cdea6d8559092092883f3 logging diff --git a/light9/web/SyncedGraph.ts b/light9/web/SyncedGraph.ts --- a/light9/web/SyncedGraph.ts +++ b/light9/web/SyncedGraph.ts @@ -156,11 +156,11 @@ export class SyncedGraph { log("not connected-- dropping patch"); return; } - if (patch.isEmpty()) throw 'should not get to this point with empty patch' + if (patch.isEmpty()) throw "should not get to this point with empty patch"; this._applyPatch(patch); if (this.client) { - log("sending patch:\n", patch.dump()) + log("sending patch:\n", patch.dump()); this.client.sendPatch(patch); } console.timeEnd("applyAndSendPatch"); @@ -170,12 +170,15 @@ export class SyncedGraph { // In most cases you want applyAndSendPatch. // // This is the only method that writes to this.graph! - log("_applyPatch [1]\n", patch.dump()); + log("_applyPatch [1] \n", patch.dump()); this.cachedFloatValues.clear(); this.cachedUriValues.clear(); patch.applyToGraph(this.graph); - log("applied patch locally", patch.summary()); - log('dump:\n'+patch.dump()); + if (false) { + log("applied patch locally", patch.summary()); + } else { + log("applied patch locally:\n" + patch.dump()); + } this.autoDeps.graphChanged(patch); } diff --git a/light9/web/patch.ts b/light9/web/patch.ts --- a/light9/web/patch.ts +++ b/light9/web/patch.ts @@ -94,7 +94,7 @@ export class Patch { this.dels.forEach((d) => lines.push(delPrefix + s(d.subject) + " " + s(d.predicate) + " " + s(d.object))); this.adds.forEach((d) => lines.push(addPrefix + s(d.subject) + " " + s(d.predicate) + " " + s(d.object))); lines.sort(); - return lines.join("\n"); + return lines.join("\n") + "\n" + (this.isEmpty() ? "(empty)" : "(nonempty)"); } async toJsonPatch(): Promise {