Parcourir la source

trace all parameters passed to trace() in flash/js/neko as a default

Nicolas Cannasse il y a 12 ans
Parent
commit
559270bd27
4 fichiers modifiés avec 18 ajouts et 4 suppressions
  1. 5 1
      std/flash/Boot.hx
  2. 4 1
      std/flash8/Boot.hx
  3. 5 1
      std/haxe/Log.hx
  4. 4 1
      std/js/Boot.hx

+ 5 - 1
std/flash/Boot.hx

@@ -145,7 +145,11 @@ class Boot extends flash.display.MovieClip {
 		var tf = getTrace();
 		var pstr = if( pos == null ) "(null)" else pos.fileName+":"+pos.lineNumber;
 		if( lines == null ) lines = [];
-		lines = lines.concat((pstr +": "+__string_rec(v,"")).split("\n"));
+		var str = pstr +": "+__string_rec(v, "");
+		if( pos != null && pos.customParams != null )
+			for( v in pos.customParams )
+				str += ","+__string_rec(v, "");
+		lines = lines.concat(str.split("\n"));
 		tf.text = lines.join("\n");
 		var stage = flash.Lib.current.stage;
 		if( stage == null )

+ 4 - 1
std/flash8/Boot.hx

@@ -181,7 +181,10 @@ class Boot {
 		untyped {
 			var root = flash.Lib.current;
 			var tf = getTrace();
-			var s = inf.fileName+(if( inf.lineNumber == null ) "" else ":"+inf.lineNumber)+": "+__string_rec(v,"");
+			var s = inf.fileName+(if( inf.lineNumber == null ) "" else ":"+inf.lineNumber)+": "+__string_rec(v, "");
+			if( inf != null && inf.customParams != null )
+				for( v in inf.customParams )
+					s += "," + __string_rec(v, "");
 			var lines : Array<String> = root.__trace_lines["concat"](s.split("\n"));
 			tf.text = lines.join("\n");
 			while( lines.length > 1 && tf.textHeight > Stage.height ) {

+ 5 - 1
std/haxe/Log.hx

@@ -51,7 +51,11 @@ class Log {
 		untyped flash.Boot.__trace(v,infos);
 			#end
 		#elseif neko
-		untyped __dollar__print(infos.fileName+":"+infos.lineNumber+": ",v,"\n");
+		untyped {
+			$print(infos.fileName + ":" + infos.lineNumber + ": ", v);
+			if( infos.customParams != null ) for( v in infos.customParams ) $print(",", v);
+			$print("\n");
+		}
 		#elseif js
 		untyped js.Boot.__trace(v,infos);
 		#elseif php

+ 4 - 1
std/js/Boot.hx

@@ -34,7 +34,10 @@ class Boot {
 			msg += __string_rec(v,"");
 			fl.trace(msg);
 			#else
-			msg += __string_rec(v,"");
+			msg += __string_rec(v, "");
+			if( i != null && i.customParams != null )
+				for( v in i.customParams )
+					msg += "," + __string_rec(v, "");
 			var d;
 			if( __js__("typeof")(document) != "undefined" && (d = document.getElementById("haxe:trace")) != null )
 				d.innerHTML += __unhtml(msg)+"<br/>";