www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - new scrapple Lib: API logging

I have posted a new library to scrapple.

http://www.dsource.org/projects/scrapple/browser/trunk/log_api

This library allows simple wrapping of function calls with logging of file 
name/line number of call, function name and argument/return values.

The intended use for this lib is for debugging the external API's. For example 

I wrote it because I was having issues with a mysql wrapper lib and wanted 
to 
known what api calls were being made.

To use it, replace the calls to be logged with wrapped calls:

ulong r = mysql_real_escape_string(connection, ret.ptr, string.ptr,
string.length);
ulong r = TraceAPI!("mysql_real_escape_string)(__FILE__,__LINE__,connection, 
ret.ptr, string.ptr, string.length);

a little fun with regex and you can have a whole file done in about a minute
Aug 13 2008