Hi,
My application requires 3 different types of logging:
Standard
Debug
Performance
I want an approach that can easily allow the user to do this:
At the moment, my code looks something like this:
//To display some standard log message
WriteLog( myMsg );
//To display a debug message
if( _debug )
{
WriteLog( myMsg );
}
//To display a performance message
if( _performance )
{
WriteLog( myMsg );
}
This bloats the code a little.
The other approach is to have a wrapper call for each.
For debug:
public void DebugMessage( string msg )
{
if( _debug )
{
WriteLog( myMsg );
}
}
Disadvantage is the code would always call the wrapper function, even if
_debug is false.
So, I am looking for a solution to this problem which reduces the amount
of of times _debug and _performance is used,
but does not have lots of redundant method calls.
Any ideas?
Using soemthing like #DEBUG is not an option either, since the logging
is configurable.
Thanks in advance for the help.
Steven
*** Sent via Developersdex http://www.developersdex.com ***