webconsole improvements

This commit is contained in:
Djeeberjr 2022-03-01 12:55:23 +01:00
parent a20d3bc07e
commit 3e275e2b06
2 changed files with 6 additions and 5 deletions

View File

@ -31,28 +31,28 @@ class Log {
public static function info(msg:Dynamic, ?pos:haxe.PosInfos) { public static function info(msg:Dynamic, ?pos:haxe.PosInfos) {
writer.writeLn("[INFO][" + pos.className + "]: " + Std.string(msg)); writer.writeLn("[INFO][" + pos.className + "]: " + Std.string(msg));
#if webconsole #if webconsole
Debug.printWeb("["+Net.instance.networkID+"][INFO][" + pos.className + "]: " + Std.string(msg)); Debug.printWeb("[INFO][" + pos.className + "]: " + Std.string(msg));
#end #end
} }
public static function warn(msg:Dynamic, ?pos:haxe.PosInfos) { public static function warn(msg:Dynamic, ?pos:haxe.PosInfos) {
writer.writeLn("[WARN][" + pos.className + "]: " + Std.string(msg), Yellow); writer.writeLn("[WARN][" + pos.className + "]: " + Std.string(msg), Yellow);
#if webconsole #if webconsole
Debug.printWeb("["+Net.instance.networkID+"][WARN][" + pos.className + "]: " + Std.string(msg)); Debug.printWeb("[WARN][" + pos.className + "]: " + Std.string(msg));
#end #end
} }
public static function error(msg:Dynamic, ?pos:haxe.PosInfos) { public static function error(msg:Dynamic, ?pos:haxe.PosInfos) {
writer.writeLn("[ERRO][" + pos.className + "]: " + Std.string(msg), Red); writer.writeLn("[ERRO][" + pos.className + "]: " + Std.string(msg), Red);
#if webconsole #if webconsole
Debug.printWeb("["+Net.instance.networkID+"][ERRO][" + pos.className + "]: " + Std.string(msg)); Debug.printWeb("[ERRO][" + pos.className + "]: " + Std.string(msg));
#end #end
} }
public static function debug(msg:Dynamic, ?pos:haxe.PosInfos) { public static function debug(msg:Dynamic, ?pos:haxe.PosInfos) {
writer.writeLn("[DEBG][" + pos.className + "]: " + Std.string(msg), Gray); writer.writeLn("[DEBG][" + pos.className + "]: " + Std.string(msg), Gray);
#if webconsole #if webconsole
Debug.printWeb("["+Net.instance.networkID+"][DEBG][" + pos.className + "]: " + Std.string(msg)); Debug.printWeb("[DEBG][" + pos.className + "]: " + Std.string(msg));
#end #end
} }

View File

@ -1,6 +1,7 @@
package util; package util;
import cc.HTTP; import cc.HTTP;
import kernel.net.Net;
import cc.ComputerCraft; import cc.ComputerCraft;
import kernel.Log; import kernel.Log;
@ -17,7 +18,7 @@ class Debug {
#if webconsole #if webconsole
public static function printWeb(msg:String) { public static function printWeb(msg:String) {
HTTP.post("http://127.0.0.1:8080/", msg); HTTP.post("http://127.0.0.1:8080/"+Net.instance.networkID, msg);
} }
#end #end
} }