incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Skogen, Espen" <espen.sko...@jpmorgan.com>
Subject RE: Trace & Log
Date Thu, 19 Jan 2012 17:45:48 GMT
Hmm, haven't really had much thought on the concept itself, but we shouldn't use [Inject] as
this would conflict with a number of IOC frameworks.

E:)


Espen Skogen | Vice President | IB Tech Market | Investment Bank | J.P. Morgan | 125 London
Wall, EC2Y 5AJ,  London, United Kingdom | T: +442077420836 | espen.skogen@jpmorgan.com | jpmorgan.com


-----Original Message-----
From: Martin Heidegger [mailto:mh@leichtgewicht.at] 
Sent: 19 January 2012 17:38
To: flex-dev@incubator.apache.org
Subject: Trace & Log

Hello dear mailinglist,

I have been tinkering and thinking and working on logging for quite a 
while now. Comparing it to other systems there is a big issue with 
logging in flash that could be dealt with elegantly by the compiler: 
Location. Many people in fact use logging systems just have some sort of 
orientation as to where their trace statements  are. In many systems 
(including Flex logging system) you'd have to write things like 
getLogger("...") to create a location-like identifier that is somewhat 
performing fast. This approach lacks the method name and line number of 
that log statement. Now: you could work around that creating errors to 
get the line number but that is a _lot_ of overhead (creating an error 
object and analyzing the stack-trace for every trace statement).

Well, as its a legacy method I suggest to create a compiler feature that 
passes the file and line-number or any other property to a method using 
meta-data.

[Inject(param="file", value="caller.file.uri")]
[Inject(param="lineNumber", value="caller.file.line")]
function log(message: String, file:String, lineNumber: uint) {}

now if somewhere we have code like:

log("hello world");

the compiler automatically fills the other strings with the meta 
information of this logging point. This way logging systems could 
efficiently use the files location and maybe a lot of other information 
about the caller like f.ex. the describeType result for the caller.

What do you think about this approach? Would you be interested in 
something like that? Maybe you know of other use cases where this might 
proof useful?

yours
Martin
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

Mime
View raw message