Perhaps i would extrapolate on my proposal. The compiler could have an extra feature that went thru and found all log statements and added a String with the classname + method name on your behalf so...
Class X void method(){ log( "Hello"); // } the log above would get modified to log( "ClassX.method" + "Hello"); This would not require runtime support and can be easily achieved by finding all log invocations and then inserting a binary op that adds the sythetic classname/method name append to the original String etc... Just an idea. On Mon, Nov 9, 2009 at 11:30 PM, stuckagain <david.no...@gmail.com> wrote: > > Joel, > > I'll take a look at it. > > The overhead is acceptable since I make sure that we only pay the > price if tracing is actually enabled. > > I'm hoping that the log API in incubator or the one from Fred will end > up in the main GWT someday ? In that case it would be a very useful if > it could auto-deduce the source of the log/trace event. > > David > > On Nov 6, 3:27 pm, Joel Webber <j...@google.com> wrote: > > It wouldn't be perfect, but you might be able to get some utility from > the > > code in StackTraceCreator (in the Core module) in the 2.0 release branch. > It > > can't get stack traces on all browsers by default (IE requires an extra > flag > > that generates a fair amount of overhead -- don't use lightly), but could > > help somewhat. > > > > On Fri, Nov 6, 2009 at 5:22 AM, Miroslav Pokorny < > miroslav.poko...@gmail.com > > > > > > > > > wrote: > > > Why not just include the class.method name at the start of each and > every > > > message String sent to your logging method...Its a pain but it works. > > > > > On Fri, Nov 6, 2009 at 7:06 PM, stuckagain <david.no...@gmail.com> > wrote: > > > > >> Hi, > > > > >> Would it be possible to implement a Trace mechanism that (when > > >> enabled) would be able to autodetermine from where it is called > > >> (classname.method). In plain java I have such a thing implemented in > > >> my tracing package and it really helps in keeping trace statements > > >> really simple. > > > > >> In the GWT client I'm using the incubator log API (I also tried out > > >> gwt-log from Fred), but none of the log/trace packages that exist > > >> today are able to detect from where they are called to give a better > > >> output. > > > > >> It looks to me that I will actually need compiler support to be able > > >> to implement such a thing. > > > > >> I read in this newsgroup that there is work going on to make > > >> stacktraces available in the browser. Could that mechanism be reused > > >> to implement what I need ? (In plain Java I get the stacktrace and > > >> find the stack element just before the trace statement). > > > > >> David > > > > > -- > > > mP- Hide quoted text - > > > > - Show quoted text - > > > -- mP --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---