[haXe] trace not working for me

Hertzel Armengol hertzel at osc.co.cr
Thu Jan 4 00:54:51 CET 2007


Roberto Saccon wrote:
> Ok, sorry for the mistake, I only realized afterwords when I took a 
> look at my implemntation, but you got it working ...
>    
>
dont worry :)
I updated it to show firebug specific messages.... Im starting to love haxe

class FirebugTrace{
       
  public function new() {
    haxe.Log.trace = log;
  }
      
  private static function log(v : Dynamic, ?inf : haxe.PosInfos )
  {
      var type:String;
     
      switch (inf.customParams[0]) {
          default:          type = "log";
           case "warn":      type = "warn";
           case "info":      type = "info";
           case "debug":     type = "debug";
           case "error":      type = "error";
      }
      var out = "javascript:console."+ type +"('FLASH: " + v + " LINE: " 
+ inf.lineNumber + "');";
      flash.Lib.getURL(out);
  }
}


class Test {
   
    static  function main() {
    var enableit = new FirebugTrace();
    trace("te cagastes","error");
    trace("Error no critico","warn");
    trace("mensaje sin nada");
}
}

and this is what you get :) enjoy
http://h.animenakama.com/galeria/main.php?g2_itemId=104



More information about the Haxe mailing list