Trace without file name and line number in Haxe
Asked Answered
S

1

9

Haxe has trace(), which can be used on all targets to print contents.

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

How do I print just the contents, without the file name and line number?

Shelba answered 26/12, 2013 at 21:37 Comment(0)
J
12

For sys targets (eg. neko, php, cpp, java, cs):

Sys.println(message);

For other targets, it depends on how you want to print the trace statement. For example, it can be customised for JS target:

haxe.Log.trace = function(msg, ?pos) js.Browser.window.console.log("trace: " + msg);
trace("ok?"); //will log to the console: trace: ok?
Jacobsen answered 26/12, 2013 at 23:13 Comment(2)
exactly what I was looking for. Sys.print()Shelba
Also as a shortcut you can do "import Sys.*;" and then just "println('hello');" or "print('hello');"Lowestoft

© 2022 - 2024 — McMap. All rights reserved.