跟踪没有HAXE文件名和行号

问题描述 投票:8回答:1

HAXE有trace(),它可以在所有目标被用来打印内容。

trace("aa"); // Main.hx:89: aa

如何打印的内容之外,没有文件名和行号?

haxe
1个回答
11
投票

对于SYS目标(例如猫,PHP,CPP,JAVA,CS):

Sys.println(message);

对于其他目标,这取决于你想如何打印跟踪语句。例如,它可以为用户定制JS目标:

haxe.Log.trace = function(msg, ?pos) js.Browser.window.console.log("trace: " + msg);
trace("ok?"); //will log to the console: trace: ok?
© www.soinside.com 2019 - 2024. All rights reserved.