mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-27 19:06:15 -04:00
Fix logging
This commit is contained in:
parent
39dc8622e6
commit
f259481c64
1 changed files with 11 additions and 6 deletions
|
@ -16,6 +16,10 @@
|
||||||
require('./jquery.class');
|
require('./jquery.class');
|
||||||
var libchangeset = require("./Changeset");
|
var libchangeset = require("./Changeset");
|
||||||
|
|
||||||
|
function log()
|
||||||
|
console.log.apply(console, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
$.Class("Changeset",
|
$.Class("Changeset",
|
||||||
{//statics
|
{//statics
|
||||||
},
|
},
|
||||||
|
@ -147,7 +151,7 @@ $.Class("RevisionCache",
|
||||||
* @param {number} head_revnum - The current head revision number. TODO: we can probably do away with this now.
|
* @param {number} head_revnum - The current head revision number. TODO: we can probably do away with this now.
|
||||||
*/
|
*/
|
||||||
init: function (connection, head_revnum) {
|
init: function (connection, head_revnum) {
|
||||||
this.log = RevisionCache.VERBOSE ? console.log : function () {};
|
this.log = RevisionCache.VERBOSE ? log : function () {};
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
this.loader = new ChangesetLoader(connection);
|
this.loader = new ChangesetLoader(connection);
|
||||||
this.revisions = {};
|
this.revisions = {};
|
||||||
|
@ -388,7 +392,7 @@ $.Class("Thread",
|
||||||
this._is_stopping = false;
|
this._is_stopping = false;
|
||||||
this._interval_id = null;
|
this._interval_id = null;
|
||||||
this._interval = interval ? interval : 1000;
|
this._interval = interval ? interval : 1000;
|
||||||
this.log = Thread.VERBOSE ? console.log : function () {};
|
this.log = Thread.VERBOSE ? log : function () {};
|
||||||
},
|
},
|
||||||
_run: function () {
|
_run: function () {
|
||||||
this.log("[thread] tick");
|
this.log("[thread] tick");
|
||||||
|
@ -426,7 +430,7 @@ $.Class("ChangesetRequest",
|
||||||
},
|
},
|
||||||
{//instance
|
{//instance
|
||||||
init: function (start, granularity, callback) {
|
init: function (start, granularity, callback) {
|
||||||
this.log = ChangesetLoader.VERBOSE ? console.log : function () {};
|
this.log = ChangesetLoader.VERBOSE ? log : function () {};
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.granularity = granularity;
|
this.granularity = granularity;
|
||||||
this.request_id = (this.granularity << 16) + this.start;
|
this.request_id = (this.granularity << 16) + this.start;
|
||||||
|
@ -467,7 +471,7 @@ Thread("ChangesetLoader",
|
||||||
this.connection.on("CHANGESET_REQ", function () {
|
this.connection.on("CHANGESET_REQ", function () {
|
||||||
_this.on_response.apply(_this, arguments);
|
_this.on_response.apply(_this, arguments);
|
||||||
});
|
});
|
||||||
this.log = ChangesetLoader.VERBOSE ? console.log : function () {};
|
this.log = ChangesetLoader.VERBOSE ? log : function () {};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Enqueue a request for changesets. The changesets will be retrieved
|
* Enqueue a request for changesets. The changesets will be retrieved
|
||||||
|
@ -621,7 +625,7 @@ var domline = require("./domline").domline;
|
||||||
$.Class("PadClient",
|
$.Class("PadClient",
|
||||||
{//static
|
{//static
|
||||||
USE_COMPOSE: false,
|
USE_COMPOSE: false,
|
||||||
VERBOSE: false,
|
VERBOSE: true,
|
||||||
},
|
},
|
||||||
{//instance
|
{//instance
|
||||||
/**
|
/**
|
||||||
|
@ -640,7 +644,7 @@ $.Class("PadClient",
|
||||||
this.authors = {};
|
this.authors = {};
|
||||||
this.dynamicCSS = libcssmanager.makeCSSManager('dynamicsyntax');
|
this.dynamicCSS = libcssmanager.makeCSSManager('dynamicsyntax');
|
||||||
this.palette = options.palette;
|
this.palette = options.palette;
|
||||||
this.log = PadClient.VERBOSE ? console.log : function () {};
|
this.log = PadClient.VERBOSE ? log : function () {};
|
||||||
|
|
||||||
this.updateAuthors(options.author_info);
|
this.updateAuthors(options.author_info);
|
||||||
|
|
||||||
|
@ -694,6 +698,7 @@ $.Class("PadClient",
|
||||||
time += changeset.deltatime * 1000;
|
time += changeset.deltatime * 1000;
|
||||||
//try {
|
//try {
|
||||||
_this.log("[transition] %d -> %d, changeset: %s", changeset.from_revision.revnum, changeset.to_revision.revnum, changeset.value);
|
_this.log("[transition] %d -> %d, changeset: %s", changeset.from_revision.revnum, changeset.to_revision.revnum, changeset.value);
|
||||||
|
_this.log(_this.alines, _this.lines, _this.apool);
|
||||||
changeset.apply(_this);
|
changeset.apply(_this);
|
||||||
/*} catch (err) {
|
/*} catch (err) {
|
||||||
log("Error applying changeset: ");
|
log("Error applying changeset: ");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue