Logging function name, line, file...

BCS BCS at pathlink.com
Mon Mar 17 16:38:59 PDT 2008


Jaro wrote:
> Is it possible to [...] in a new logging macro?

sort version, no. Because the values of __LINE__ and __FILE__ are 
substituted very early in the processing (possibly in the lexer) so they 
will always resolve to the value at the location of the text string it's 
self.

Long version: If you really need it, try something like:

sed "s/myLoggingFunction(/myRealLoggingFunction(__FILE__,__LINE__,/g"

it's ugly but gets the job done. Also if you define myLoggingFunction to 
do something sane, it works fine without the sed pass.



More information about the Digitalmars-d mailing list