[haXe] trace not working for me
Marcelo de Moraes Serpa
celoserpa at gmail.com
Thu Jan 4 20:19:45 CET 2007
Hmm... this seems to have turned out into a nice logging solution for haxe..
great work guys!
Marcelo.
On 1/4/07, Roberto Saccon <rsaccon at gmail.com> wrote:
>
> I just updated to CVS and tested the new freaking cool tracing stuff:
>
> if (haxe.Firebug.detect()) haxe.Firebug.redirectTraces();
>
> that blows away any other trace solution I tried so far (with
> debugging-player, own socketserver, etc.)
>
> regards
> Roberto
>
> On 1/4/07, Nicolas Cannasse <ncannasse at motion-twin.com> 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
> >
> > Now in the standard library (haxe.Firebug) !
> > Works for both Javascript, Flash 6-7-8 and Flash 9
> >
> > class Firebug {
> >
> > public static function redirectTraces() {
> > haxe.Log.trace = trace;
> > }
> >
> > public static function trace(v : Dynamic, ?inf : haxe.PosInfos )
> > {
> > var type = if( inf.customParams != null )
> > inf.customParams[0] else null;
> > if( type != "warn" && type != "info" && type != "debug"
> > && type !=
> > "error" )
> > type = "log";
> > #if flash
> > var out = "javascript:console."+ type +"('" +
> > inf.fileName + ":" +
> > inf.lineNumber + " : " +
> > Std.string(v).split("\\").join("\\\\").split("'").join('\\"') + "');";
> > #if flash9
> > var l = new flash.net.URLLoader();
> > l.addEventListener( "ioError", function(e){} );
> > l.load(new flash.net.URLRequest(out));
> > #else true
> > flash.Lib.getURL(out);
> > #end // flash9
> > #else js
> > untyped console[type](inf.fileName+":"+inf.lineNumber+"
> > :
> > "+Std.string(v));
> > #else error
> > #end
> > }
> >
> > }
> > Nicolas
> >
> > --
> > haXe - an open source web programming language
> > http://haxe.org
> >
>
>
>
> --
> Roberto Saccon
> --
> haXe - an open source web programming language
> http://haxe.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20070104/b4bd79e6/attachment.htm
More information about the Haxe
mailing list