Selaa lähdekoodia

[java/cs] fixed issue #1643

Caue Waneck 12 vuotta sitten
vanhempi
commit
3658785938
1 muutettua tiedostoa jossa 18 lisäystä ja 9 poistoa
  1. 18 9
      std/haxe/Log.hx

+ 18 - 9
std/haxe/Log.hx

@@ -29,16 +29,16 @@ class Log {
 
 
 	/**
 	/**
 		Outputs [v] in a platform-dependent way.
 		Outputs [v] in a platform-dependent way.
-		
+
 		The second parameter [infos] is injected by the compiler and contains
 		The second parameter [infos] is injected by the compiler and contains
 		information about the position where the trace() call was made.
 		information about the position where the trace() call was made.
-		
+
 		This method can be rebound to a custom function:
 		This method can be rebound to a custom function:
 			var oldTrace = haxe.Log.trace; // store old function
 			var oldTrace = haxe.Log.trace; // store old function
 			haxe.Log.trace = function(v,infos) { // handle trace }
 			haxe.Log.trace = function(v,infos) { // handle trace }
 			...
 			...
 			haxe.Log.trace = oldTrace;
 			haxe.Log.trace = oldTrace;
-			
+
 		If it is bound to null, subsequent calls to trace() will cause an
 		If it is bound to null, subsequent calls to trace() will cause an
 		exception.
 		exception.
 	**/
 	**/
@@ -71,12 +71,21 @@ class Log {
       }
       }
       else
       else
 		   untyped __trace(v,infos);
 		   untyped __trace(v,infos);
-		#elseif cs
-		var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
-		untyped __cs__("System.Console.WriteLine(str)");
-		#elseif java
-		var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
-		untyped __java__("java.lang.System.out.println(str)");
+		#elseif (cs || java)
+		var str:String = null;
+		if (infos != null)
+		{
+			str = infos.fileName + ":" + infos.lineNumber + ": " + v;
+			if (infos.customParams != null)
+			{
+				str += "," + infos.customParams.join(",");
+			}
+		}
+			#if cs
+			untyped __cs__("System.Console.WriteLine(str)");
+			#elseif java
+			untyped __java__("java.lang.System.out.println(str)");
+			#end
 		#end
 		#end
 	}
 	}