improved logging system

This commit is contained in:
2024-08-17 00:47:15 +02:00
parent afc0309222
commit 39a7da716c
3 changed files with 122 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
package lib;
import kernel.http.HTTPRequest.Http;
import lua.TableTools;
import kernel.KernelEvents;
import kernel.log.Log;
import lua.NativeStringTools;
import lib.ui.Canvas;
@@ -9,6 +9,7 @@ import cc.ComputerCraft;
#if webconsole
import cc.HTTP;
import kernel.net.Net;
import kernel.log.LogLine;
#end
class Debug {
@@ -66,8 +67,8 @@ class Debug {
#end
#if webconsole
public static function printWeb(msg:String) {
HTTP.request("http://127.0.0.1:8080/" + Net.networkID, msg);
public static function logToWebconsole(line:LogLine) {
Http.request('http://127.0.0.1:8080/log/${Net.networkID}/${line.level.getIndex()}', '[${line.origin}] ${line.message}').eager();
}
#end
}