Login  Register

Re: Newbie question on adding trace statements

Posted by Luigi Ballabio on Jan 04, 2005; 12:50am
URL: http://quantlib.414.s1.nabble.com/Newbie-question-on-adding-trace-statements-tp3463p3466.html

On 01/04/05 04:56:35, Joseph Wang wrote:
> There should probably be the concept of different debug levels, so that  
> you can set things up for minimal trace or dump every single number.

Yes, that stroke me after sending my reply. There should be a way to  
selectively emit information.

> The interface should probably look like
>
> QL_TRACE(int tracelevel, output);
>
> Settings::instance.setTraceLevel(int);

Another way might be to add a tag:

    QL_TRACE(const std::string& tag, output);

    Settings::instance().enableTracing(tag);

The above could be useful as a particular task could be traced in  
isolation, without tracing from different parts of the library confusing  
the output. Were you thinking of the tracing facility as a development/
debugging aid (in which case I'd favor the second solution) or as a logging  
facility to be made available to end-users (in which case I'd favor the  
first?)  Or could these be two separate facilities?

Later,
        Luigi

P.S. I'll be away for a few days starting tomorrow ("away" as in both "from  
the office" and "from the net".) I might not be very responsive during that  
time :)