CSharpTest.Net
SetOutputLevel Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Logging Assembly > (Global) Namespace > Log.Config Class : SetOutputLevel Method

outputToConfigure
newLevel

Glossary Item Box

Changes the log level required to write to a specific output device.

Syntax

Visual Basic (Declaration) 
Public Shared Function SetOutputLevel( _
   ByVal outputToConfigure As LogOutputs, _
   ByVal newLevel As LogLevels _
) As LogLevels
C# 
public static LogLevels SetOutputLevel( 
   LogOutputs outputToConfigure,
   LogLevels newLevel
)

Parameters

outputToConfigure
newLevel

Example

Log/Test/ConfigTest.cs

C#Copy Code
string origLog = Log.Config.EventLogName;
string origSrc = Log.Config.EventLogSource;

Log.Config.EventLogName = "Dua!";
Assert.AreEqual("Dua!", Log.Config.EventLogName);
Log.Config.EventLogSource = "Yea.";
Assert.AreEqual("Yea.", Log.Config.EventLogSource);
try
{
    Log.Config.EventLogName = "Application";
    Log.Config.EventLogSource = "MsiInstaller";

    Log.Config.Output = LogOutputs.EventLog;
    Log.Config.SetOutputLevel(LogOutputs.EventLog, LogLevels.Info);
    Log.Write("Logging.Test has hijacked your MsiInstaller source for testing use.  Ignore this message.");
}
finally
{
    RestoreLogState();
    Log.Config.EventLogName = "Application";
    Log.Config.EventLogSource = "Logging.Test";
}
VB.NETCopy Code
Dim origLog As String = Log.Config.EventLogName
Dim origSrc As String = Log.Config.EventLogSource

Log.Config.EventLogName = "Dua!"
Assert.AreEqual("Dua!", Log.Config.EventLogName)
Log.Config.EventLogSource = "Yea."
Assert.AreEqual("Yea.", Log.Config.EventLogSource)
Try
    Log.Config.EventLogName = "Application"
    Log.Config.EventLogSource = "MsiInstaller"

    Log.Config.Output = LogOutputs.EventLog
    Log.Config.SetOutputLevel(LogOutputs.EventLog, LogLevels.Info)
    Log.Write("Logging.Test has hijacked your MsiInstaller source for testing use.  Ignore this message.")
Finally
    RestoreLogState()
    Log.Config.EventLogName = "Application"
    Log.Config.EventLogSource = "Logging.Test"
End Try

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys