[log] use custom print in TraceLogger

This commit is contained in:
2018-04-06 16:30:31 +03:00
parent 4487aedee7
commit 167d43342a

View File

@@ -1,5 +1,7 @@
package haxework.log;
import haxe.PosInfos;
class TraceLogger extends BaseLogger {
@@ -7,7 +9,42 @@ class TraceLogger extends BaseLogger {
super();
}
public static function print(v: Dynamic, ?infos : PosInfos) : Void {
#if flash
#if (fdb || native_trace)
var str = flash.Boot.__string_rec(v, "");
untyped __global__["trace"](str);
#else
untyped flash.Boot.__trace(v);
#end
#elseif neko
untyped {
$print(v);
$print("\n");
}
#elseif js
untyped js.Boot.__trace(v);
#elseif (php && php7)
php.Boot.trace(v);
#elseif php
untyped __call__('_hx_trace', v);
#elseif cpp
untyped __trace(v, infos);
#elseif cs
cs.system.Console.WriteLine(v);
#elseif java
untyped __java__("java.lang.System.out.println(v)");
#elseif lua
untyped __define_feature__("use._hx_print",_hx_print(v));
#elseif (python)
python.Lib.println(v);
#elseif hl
var str = Std.string(v);
Sys.println(str);
#end
}
override private function write(text:String):Void {
haxe.Log.trace(text);
print(text);
}
}