Prev | Current Page 349 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


The signature for the haxe.Log.trace function looks like the following:
static haxe.Log.trace( v : Dynamic, ?pos : haxe.PosInfos ) : Void;
The Dynamic parameter accepts any type you wish to output in your trace, whether this is a string,
integer, or object. For very complex custom objects, it is often a good idea to provide a toString()
method that will parse the data in a way that makes sense to you. You could then pass the return value
of this method to the trace function. However, if you omit such a method, the trace function will do
its best to describe the object in as much detail as it can. If a toString() method exists in your object,
the trace function will automatically utilize it, so you do not have to do this explicitly.
The second parameter of the trace function is a typedef containing the following data types:
typedef PosInfos = {
var fileName : String;
var lineNumber : Int;
var className : String;
var methodName : String;
var customParams : Array < Dynamic > ;
}
The first four properties of this typedef are pretty self - explanatory.


Pages:
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361