mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Clean up startup logging
Now we do boot logging to an array. We harvest it in the —verbose command. We still need to provide a way to access the log in the browser too.
This commit is contained in:
parent
f9f8ad725b
commit
31e1088aa7
24
boot/boot.js
24
boot/boot.js
@ -45,6 +45,11 @@ if($tw.node) {
|
|||||||
|
|
||||||
/////////////////////////// Utility functions
|
/////////////////////////// Utility functions
|
||||||
|
|
||||||
|
$tw.boot.log = function(str) {
|
||||||
|
$tw.boot.logMessages = $tw.boot.logMessages || [];
|
||||||
|
$tw.boot.logMessages.push(str);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check if an object has a property
|
Check if an object has a property
|
||||||
*/
|
*/
|
||||||
@ -1754,18 +1759,19 @@ $tw.boot.executeNextStartupTask = function() {
|
|||||||
if($tw.boot.isStartupTaskEligible(task)) {
|
if($tw.boot.isStartupTaskEligible(task)) {
|
||||||
// Remove this task from the list
|
// Remove this task from the list
|
||||||
$tw.boot.remainingStartupModules.splice(taskIndex,1);
|
$tw.boot.remainingStartupModules.splice(taskIndex,1);
|
||||||
var s = ["Executing task:",task.name];
|
// Assemble log message
|
||||||
if(task.platforms) {
|
var s = ["Startup task:",task.name];
|
||||||
|
if(task.platforms) {
|
||||||
s.push("platforms:",task.platforms.join(","));
|
s.push("platforms:",task.platforms.join(","));
|
||||||
}
|
}
|
||||||
if(task.after) {
|
if(task.after) {
|
||||||
s.push("after:",task.after.join(","));
|
s.push("after:",task.after.join(","));
|
||||||
}
|
}
|
||||||
if(task.before) {
|
if(task.before) {
|
||||||
s.push("before:",task.before.join(","));
|
s.push("before:",task.before.join(","));
|
||||||
}
|
}
|
||||||
console.log(s.join(" "));
|
$tw.boot.log(s.join(" "));
|
||||||
// Execute it
|
// Execute task
|
||||||
if(!$tw.utils.hop(task,"synchronous") || task.synchronous) {
|
if(!$tw.utils.hop(task,"synchronous") || task.synchronous) {
|
||||||
task.startup();
|
task.startup();
|
||||||
if(task.name) {
|
if(task.name) {
|
||||||
|
@ -24,6 +24,8 @@ var Command = function(params,commander) {
|
|||||||
|
|
||||||
Command.prototype.execute = function() {
|
Command.prototype.execute = function() {
|
||||||
this.commander.verbose = true;
|
this.commander.verbose = true;
|
||||||
|
// Output the boot message log
|
||||||
|
this.commander.streams.output.write("Boot log:\n " + $tw.boot.logMessages.join("\n ") + "\n");
|
||||||
return null; // No error
|
return null; // No error
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user