public void Write( LogMessageLevel level, bool maskDebug, string message, params object[] substitutions )
{
if ( _isDisposed )
return;
if ( message == null )
throw new ArgumentNullException( "The log message cannot be null" );
if ( ( (int)logLevel + (int)level ) > LogThreshold )
return; //too verbose a message to write
// construct the log message
if ( substitutions != null && substitutions.Length > 0 )
{
message = string.Format( message, substitutions );
}
// write the the debug output if requested
if ( debugOutput && !maskDebug )
{
System.Diagnostics.Debug.WriteLine( message );
}
if ( writer != null && writer.BaseStream != null )
{
// prepend the current time to the message
message = string.Format( "[{0}] {1}", DateTime.Now.ToString( "hh:mm:ss" ), message );
// write the message and flush the buffer
writer.WriteLine( message );
//writer auto-flushes
}
FireMessageLogged( level, maskDebug, message );
}