mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-01 13:00:49 +00:00
Revert "Improve command line logging (#3704)"
This reverts commit 25ec52b912
.
This commit is contained in:
parent
36a9e3f54e
commit
6833ccdb97
@ -120,7 +120,7 @@ Command.prototype.fetchFile = function(url,options,callback,redirectCount) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
response.on("error",function(e) {
|
response.on("error",function(e) {
|
||||||
self.commander.log("Error on GET request: " + e);
|
console.log("Error on GET request: " + e);
|
||||||
callback(e);
|
callback(e);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -47,7 +47,7 @@ Render individual tiddlers and save the results to the specified files
|
|||||||
$tw.utils.each(tiddlers,function(title) {
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
var filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
var filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
||||||
if(self.commander.verbose) {
|
if(self.commander.verbose) {
|
||||||
self.commander.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
||||||
}
|
}
|
||||||
var parser = wiki.parseTiddler(template || title),
|
var parser = wiki.parseTiddler(template || title),
|
||||||
widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title,storyTiddler: title})}),
|
widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title,storyTiddler: title})}),
|
||||||
|
@ -48,7 +48,7 @@ Saves individual tiddlers in their raw text or binary format to the specified fi
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(self.commander.verbose) {
|
if(self.commander.verbose) {
|
||||||
self.commander.log("Saving \"" + title + "\" to \"" + filepath + "\"");
|
console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\"");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$tw.utils.saveTiddlerToFileSync(tiddler,fileInfo);
|
$tw.utils.saveTiddlerToFileSync(tiddler,fileInfo);
|
||||||
|
@ -33,13 +33,7 @@ function Server(options) {
|
|||||||
this.routes = options.routes || [];
|
this.routes = options.routes || [];
|
||||||
this.authenticators = options.authenticators || [];
|
this.authenticators = options.authenticators || [];
|
||||||
this.wiki = options.wiki;
|
this.wiki = options.wiki;
|
||||||
this.logger = new $tw.utils.Logger("server",{colour: "cyan"});
|
|
||||||
this.logger.setPrefix(":" + process.pid + "-" + (Number(new Date()) - 1095776640000));
|
|
||||||
this.boot = options.boot || $tw.boot;
|
this.boot = options.boot || $tw.boot;
|
||||||
// Name the server and init the boot state
|
|
||||||
this.servername = $tw.utils.transliterateToSafeASCII(this.get("server-name") || this.wiki.getTiddlerText("$:/SiteTitle") || "TiddlyWiki5");
|
|
||||||
this.boot.origin = this.get("origin")? this.get("origin"): this.protocol+"://"+this.get("host")+":"+this.get("port");
|
|
||||||
this.boot.pathPrefix = this.get("path-prefix") || "";
|
|
||||||
// Initialise the variables
|
// Initialise the variables
|
||||||
this.variables = $tw.utils.extend({},this.defaultVariables);
|
this.variables = $tw.utils.extend({},this.defaultVariables);
|
||||||
if(options.variables) {
|
if(options.variables) {
|
||||||
@ -98,6 +92,10 @@ function Server(options) {
|
|||||||
this.protocol = "https";
|
this.protocol = "https";
|
||||||
}
|
}
|
||||||
this.transport = require(this.protocol);
|
this.transport = require(this.protocol);
|
||||||
|
// Name the server and init the boot state
|
||||||
|
this.servername = $tw.utils.transliterateToSafeASCII(this.get("server-name") || this.wiki.getTiddlerText("$:/SiteTitle") || "TiddlyWiki5");
|
||||||
|
this.boot.origin = this.get("origin")? this.get("origin"): this.protocol+"://"+this.get("host")+":"+this.get("port");
|
||||||
|
this.boot.pathPrefix = this.get("path-prefix") || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -289,9 +287,9 @@ Server.prototype.requestHandler = function(request,response,options) {
|
|||||||
var route = self.findMatchingRoute(request,state);
|
var route = self.findMatchingRoute(request,state);
|
||||||
// Optionally output debug info
|
// Optionally output debug info
|
||||||
if(self.get("debug-level") !== "none") {
|
if(self.get("debug-level") !== "none") {
|
||||||
self.logger.log("Request path:",JSON.stringify(state.urlInfo.href));
|
console.log("Request path:",JSON.stringify(state.urlInfo));
|
||||||
self.logger.log("Request headers:",JSON.stringify(request.headers));
|
console.log("Request headers:",JSON.stringify(request.headers));
|
||||||
self.logger.log("authenticatedUsername:",state.authenticatedUsername);
|
console.log("authenticatedUsername:",state.authenticatedUsername);
|
||||||
}
|
}
|
||||||
// Return a 404 if we didn't find a route
|
// Return a 404 if we didn't find a route
|
||||||
if(!route) {
|
if(!route) {
|
||||||
|
@ -21,7 +21,6 @@ function Logger(componentName,options) {
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
this.componentName = componentName || "";
|
this.componentName = componentName || "";
|
||||||
this.colour = options.colour || "white";
|
this.colour = options.colour || "white";
|
||||||
this.prefix = options.prefix || "";
|
|
||||||
this.enable = "enable" in options ? options.enable : true;
|
this.enable = "enable" in options ? options.enable : true;
|
||||||
this.save = "save" in options ? options.save : true;
|
this.save = "save" in options ? options.save : true;
|
||||||
this.saveLimit = options.saveLimit || 100 * 1024;
|
this.saveLimit = options.saveLimit || 100 * 1024;
|
||||||
@ -34,20 +33,6 @@ Logger.prototype.setSaveBuffer = function(logger) {
|
|||||||
this.saveBufferLogger = logger;
|
this.saveBufferLogger = logger;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Change the output colour
|
|
||||||
*/
|
|
||||||
Logger.prototype.setColour = function(colour) {
|
|
||||||
this.colour = colour || "white";
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Change the prefix
|
|
||||||
*/
|
|
||||||
Logger.prototype.setPrefix = function(prefix) {
|
|
||||||
this.prefix = prefix || "";
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Log a message
|
Log a message
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user