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

Glossary Item Box

Sets the event log source we will write events with, It's up to you to register this value.

Syntax

Visual Basic (Declaration) 
Public Shared Property EventLogSource As String
C# 
public static string EventLogSource {get; set;}

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