public static function trace(v : Dynamic, ?inf : haxe.PosInfos ) { var type = if( inf != null && inf.customParams != null ) inf.customParams[0] else null; if( type != "warn" && type != "info" && type != "debug" && type != "error" ) type = if( inf == null ) "error" else "log"; #if flash var str = if( inf == null ) "" else inf.fileName + ":" + inf.lineNumber + " : "; try str += Std.string(v) catch( e : Dynamic ) str += "????"; #if flash9 // in Flash9, it is needed to use _self with getURL and // only the latest call per frame is processed, so it's // needed to use ExternalInterface (URLLoader displays // security errors for remote files) str = str.split("\\").join("\\\\"); flash.external.ExternalInterface.call("console."+type,str); #else true str = str.split("\\").join("\\\\").split("'").join("\\'").split("\n").join("\\n").split("\r").join("\\r"); str = StringTools.urlEncode(str); var out = "javascript:console."+ type +"('"+str+"');"; flash.Lib.getURL(out); #end // flash9 #else js untyped console[type]( (if( inf == null ) "" else inf.fileName+":"+inf.lineNumber+" : ") + Std.string(v) ); #else neko var str = inf.fileName + ":" + inf.lineNumber + " : "; try str += Std.string(v) catch( e : Dynamic ) str += "???"; neko.Lib.print(''); #else error #end }