write pre-vfs logs to logfile

This commit is contained in:
Lisa Milne 2023-11-27 21:54:27 +10:00
parent b070abf90d
commit f2be72edc1

View file

@ -1345,6 +1345,7 @@ clite.vfs = {
};
clite.log = {
logs:[],
init:function(vfs) {
clite.log.write = function(txt) {
if (!clite.user.hasLogin() || (typeof clite.init == 'number' && clite.init != 3)) {
@ -1357,9 +1358,13 @@ clite.log = {
n.data.content += txt+'\n';
console.log(txt);
}
var n = vfs.getNode('/var/logs');
if (n)
n.data.content = clite.log.logs.join('\n')+'\n';
clite.core.execSafeAsync(function(){clite.log.init = null;});
},
write:function(txt) {
clite.log.logs.push(txt);
try {
clite.term.writeLine(txt);
} catch(e) {}