< Summary - EventLogHelper Code Coverage

Information
Class: EventLogHelper.SmartEventLogger
Assembly: EventLogHelper
File(s): C:\Agent\_work\5\s\Code\EventLogHelper\EventLogHelper\SmartEventLogger.vb
Tag: EventLogHelper Build_2026.9.7.1_#617
Line coverage
100%
Covered lines: 1857
Uncovered lines: 0
Coverable lines: 1857
Total lines: 6626
Line coverage: 100%
Branch coverage
100%
Covered branches: 90
Total branches: 90
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 7/24/2025 - 11:19:20 PM Line coverage: 100% (164/164) Branch coverage: 100% (26/26) Total lines: 685 Tag: EventLogHelper Build_2025.7.24.11_#5198/2/2025 - 3:24:15 PM Line coverage: 100% (604/604) Branch coverage: 100% (36/36) Total lines: 2024 Tag: EventLogHelper Build_2025.8.2.1_#5448/2/2025 - 7:24:10 PM Line coverage: 100% (604/604) Branch coverage: 100% (36/36) Total lines: 2045 Tag: EventLogHelper Build_2025.8.2.2_#5458/3/2025 - 11:25:05 PM Line coverage: 100% (733/733) Branch coverage: 100% (36/36) Total lines: 2542 Tag: EventLogHelper Build_2025.8.3.1_#5468/7/2025 - 12:14:34 AM Line coverage: 100% (793/793) Branch coverage: 100% (60/60) Total lines: 3006 Tag: EventLogHelper Build_2025.8.7.1_#5488/10/2025 - 6:37:00 PM Line coverage: 100% (1010/1010) Branch coverage: 100% (76/76) Total lines: 3560 Tag: EventLogHelper Build_2025.8.10.1_#5498/16/2025 - 2:28:27 AM Line coverage: 100% (1792/1792) Branch coverage: 100% (84/84) Total lines: 6437 Tag: EventLogHelper Build_2025.8.16.1_#5508/17/2025 - 8:10:12 PM Line coverage: 100% (1818/1818) Branch coverage: 100% (92/92) Total lines: 6513 Tag: EventLogHelper Build_2025.8.17.1_#5529/8/2025 - 12:45:09 AM Line coverage: 100% (1838/1838) Branch coverage: 100% (82/82) Total lines: 6587 Tag: EventLogHelper Build_2025.9.8.1_#5569/10/2025 - 8:30:32 AM Line coverage: 100% (1861/1861) Branch coverage: 100% (90/90) Total lines: 6625 Tag: EventLogHelper Build_2025.9.10.2_#5599/30/2025 - 8:29:34 PM Line coverage: 100% (1857/1857) Branch coverage: 100% (90/90) Total lines: 6626 Tag: EventLogHelper Build_2025.9.30.4_#565 7/24/2025 - 11:19:20 PM Line coverage: 100% (164/164) Branch coverage: 100% (26/26) Total lines: 685 Tag: EventLogHelper Build_2025.7.24.11_#5198/2/2025 - 3:24:15 PM Line coverage: 100% (604/604) Branch coverage: 100% (36/36) Total lines: 2024 Tag: EventLogHelper Build_2025.8.2.1_#5448/2/2025 - 7:24:10 PM Line coverage: 100% (604/604) Branch coverage: 100% (36/36) Total lines: 2045 Tag: EventLogHelper Build_2025.8.2.2_#5458/3/2025 - 11:25:05 PM Line coverage: 100% (733/733) Branch coverage: 100% (36/36) Total lines: 2542 Tag: EventLogHelper Build_2025.8.3.1_#5468/7/2025 - 12:14:34 AM Line coverage: 100% (793/793) Branch coverage: 100% (60/60) Total lines: 3006 Tag: EventLogHelper Build_2025.8.7.1_#5488/10/2025 - 6:37:00 PM Line coverage: 100% (1010/1010) Branch coverage: 100% (76/76) Total lines: 3560 Tag: EventLogHelper Build_2025.8.10.1_#5498/16/2025 - 2:28:27 AM Line coverage: 100% (1792/1792) Branch coverage: 100% (84/84) Total lines: 6437 Tag: EventLogHelper Build_2025.8.16.1_#5508/17/2025 - 8:10:12 PM Line coverage: 100% (1818/1818) Branch coverage: 100% (92/92) Total lines: 6513 Tag: EventLogHelper Build_2025.8.17.1_#5529/8/2025 - 12:45:09 AM Line coverage: 100% (1838/1838) Branch coverage: 100% (82/82) Total lines: 6587 Tag: EventLogHelper Build_2025.9.8.1_#5569/10/2025 - 8:30:32 AM Line coverage: 100% (1861/1861) Branch coverage: 100% (90/90) Total lines: 6625 Tag: EventLogHelper Build_2025.9.10.2_#5599/30/2025 - 8:29:34 PM Line coverage: 100% (1857/1857) Branch coverage: 100% (90/90) Total lines: 6626 Tag: EventLogHelper Build_2025.9.30.4_#565

Coverage delta

Coverage delta 1 -1

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
SetWriter(...)100%11100%
SetWriter(...)100%11100%
SetRegistryReader(...)100%11100%
SetRegistryReader(...)100%11100%
Initialize()100%88100%
Initialize()100%88100%
InitializeConfiguration()100%11100%
InitializeConfiguration()100%11100%
Reset()100%11100%
Reset()100%11100%
get_MachineName()100%11100%
get_MachineName()100%11100%
set_MachineName(...)100%11100%
set_MachineName(...)100%11100%
get_LogName()100%11100%
get_LogName()100%11100%
set_LogName(...)100%11100%
set_LogName(...)100%11100%
get_SourceName()100%11100%
get_SourceName()100%11100%
set_SourceName(...)100%11100%
set_SourceName(...)100%11100%
get_MaxKilobytes()100%11100%
get_MaxKilobytes()100%11100%
set_MaxKilobytes(...)100%11100%
set_MaxKilobytes(...)100%11100%
get_RetentionDays()100%11100%
get_RetentionDays()100%11100%
set_RetentionDays(...)100%11100%
set_RetentionDays(...)100%11100%
get_WriteInitEntry()100%11100%
get_WriteInitEntry()100%11100%
set_WriteInitEntry(...)100%11100%
set_WriteInitEntry(...)100%11100%
get_TruncationMarker()100%11100%
get_TruncationMarker()100%11100%
set_TruncationMarker(...)100%11100%
set_TruncationMarker(...)100%11100%
get_ContinuationMarker()100%11100%
get_ContinuationMarker()100%11100%
set_ContinuationMarker(...)100%11100%
set_ContinuationMarker(...)100%11100%
get_AllowMultiEntryMessages()100%11100%
get_AllowMultiEntryMessages()100%11100%
set_AllowMultiEntryMessages(...)100%11100%
set_AllowMultiEntryMessages(...)100%11100%
get_IsInitialized()100%11100%
get_IsInitialized()100%11100%
get_IncludeSourceInMessage()100%11100%
get_IncludeSourceInMessage()100%11100%
set_IncludeSourceInMessage(...)100%11100%
set_IncludeSourceInMessage(...)100%11100%
get_CurrentLoggingLevel()100%11100%
get_CurrentLoggingLevel()100%11100%
set_CurrentLoggingLevel(...)100%11100%
set_CurrentLoggingLevel(...)100%11100%
get_LoggingSeverity()100%11100%
get_LoggingSeverity()100%11100%
set_LoggingSeverity(...)100%11100%
set_LoggingSeverity(...)100%11100%
get_SourceResolutionBehavior()100%11100%
get_SourceResolutionBehavior()100%11100%
set_SourceResolutionBehavior(...)100%11100%
set_SourceResolutionBehavior(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%11100%
Log(...)100%1010100%
Log(...)100%1010100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%11100%
LogEntry(...)100%88100%
LogEntry(...)100%88100%
Source(...)100%88100%
Source(...)100%8894.73%
DefaultSource(...)100%11100%
DefaultSource(...)100%11100%
DefaultSource(...)100%11100%
DefaultSource(...)100%11100%
MaxSource(...)100%44100%
MaxSource(...)100%44100%
IsSourceRegisteredToLog(...)100%11100%
IsSourceRegisteredToLog(...)100%11100%
CanReadRegistryForLogAndSource(...)100%11100%
CanReadRegistryForLogAndSource(...)100%11100%
CanReadRegistryForLog(...)100%11100%
CanReadRegistryForLog(...)100%11100%
NormalizeMessage(...)100%1212100%
NormalizeMessage(...)100%1212100%
SplitMessageIntoPages(...)100%1414100%
SplitMessageIntoPages(...)100%1414100%
NormalizeEventType(...)100%44100%
NormalizeEventType(...)100%44100%
NormalizeMachineName(...)100%44100%
NormalizeMachineName(...)100%44100%
GetAppSetting(...)100%44100%
GetAppSetting(...)100%44100%
GetAppSetting(...)100%22100%
GetAppSetting(...)100%22100%
GetAppSetting(...)100%22100%
GetAppSetting(...)100%22100%
GetAppSetting(...)100%44100%
GetAppSetting(...)100%44100%
GetLog()100%11100%
GetLog()100%11100%
GetLog(...)100%11100%
GetLog(...)100%11100%
GetLog(...)100%11100%
GetLog(...)100%11100%
GetLog(...)100%11100%
GetLog(...)100%11100%
GetLog(...)100%11100%
GetLog(...)100%11100%
GetLog(...)100%11100%
GetLog(...)100%11100%

File(s)

C:\Agent\_work\5\s\Code\EventLogHelper\EventLogHelper\SmartEventLogger.vb

#LineLine coverage
 1Imports Microsoft.Win32
 2Imports System.Reflection
 3Imports System.Runtime.CompilerServices
 4Imports EventLogHelper.Enums
 5Imports EventLogHelper.Interfaces
 6Imports System.Globalization
 7
 8#If NETFRAMEWORK Then
 9Imports System.Configuration
 10#Else
 11Imports System.IO
 12Imports Microsoft.Extensions.Configuration
 13#End If
 14
 15''' <summary>
 16''' Provides high-level utilities for logging to the Windows Event Log in a simplified and customizable way.
 17''' </summary><remarks>
 18''' <para>
 19''' This module abstracts common patterns for writing entries to the Windows Event Log. It simplifies usage by handling:
 20''' </para>
 21''' <list type="bullet">
 22'''   <item>Automatic validation and creation of logs and sources.</item>
 23'''   <item>Falls back when <c>log</c> or <c>source</c> parameters are not provided.</item>
 24'''   <item>Automatic source naming based on the calling method and class context.</item>
 25'''   <item>Safe handling and truncation of long messages to comply with system limits.</item>
 26''' </list>
 27''' <para>
 28''' The default event log is <c>Application</c>. If no source is provided, a fully qualified method name
 29''' (including namespace and class) is used as the source identifier.
 30''' </para>
 31''' <para>
 32''' This module is suitable for both production use (via <see cref="RealEventLogWriter" />) and unit testing
 33''' (via a test implementation such as <c>EventLogHelper.Tests.TestEventLogWriter</c> in a separate test project).
 34''' </para>
 35''' </remarks>
 36Public Module SmartEventLogger
 37
 38#Region " Process Support Objects ^^^^^^^^^^^^^^^^^^^^^^^^^ "
 39
 40    ''' <summary>
 41    ''' The current event log writer instance used by the logger.
 42    ''' </summary>
 43    ''' <remarks>
 44    ''' By default, this is initialized to an instance of <see cref="RealEventLogWriter"/>, which writes to the actual
 45    ''' Windows Event Log. This field is typically replaced during testing with a mock or stub implementation via the
 46    ''' <see cref="SetWriter"/> method.
 47    ''' </remarks>
 1248    Private _writer As IEventLogWriter = New RealEventLogWriter()
 49    ''' <summary>
 50    ''' The registry reader
 51    ''' </summary>
 1252    Private _registryReader As IRegistryReader = New RealRegistryReader()
 53
 54    ''' <summary>
 55    ''' Sets the <see cref="IEventLogWriter"/> implementation used for logging operations.
 56    ''' </summary>
 57    ''' <param name="writer">
 58    ''' The custom writer instance to use. This allows swapping out the default <see cref="RealEventLogWriter"/>
 59    ''' for testing or alternate logging implementations.
 60    ''' </param>
 61    ''' <remarks>
 62    ''' This method is primarily intended for use in unit tests or advanced scenarios where log output should be redirec
 63    ''' or suppressed. For example, a test implementation may capture and inspect log data without writing to the real e
 64    ''' </remarks>
 35465    Public Sub SetWriter(writer As IEventLogWriter)
 66
 70867        _writer = writer
 68
 70869    End Sub
 70
 71    ''' <summary>
 72    ''' Specifies the <see cref="IRegistryReader"/> implementation to use when accessing
 73    ''' the Windows Registry for log-related operations (e.g., determining default event log sources).
 74    ''' </summary>
 75    ''' <param name="reader">
 76    ''' The custom <see cref="IRegistryReader"/> instance to use. This is typically used for unit testing
 77    ''' or customizing how registry access is performed. If not set, the default implementation will be used.
 78    ''' </param>
 79    ''' <remarks>
 80    ''' This method allows injection of a mock or testable registry reader. In production,
 81    ''' a default <c>RealRegistryReader</c> is used, but in unit tests, you may inject a fake
 82    ''' reader to simulate different registry states without accessing the actual system registry.
 83    ''' </remarks>
 7284    Public Sub SetRegistryReader(reader As IRegistryReader)
 85
 14486        _registryReader = reader
 87
 14488    End Sub
 89
 90#End Region
 91
 92#Region " Initialization ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 93
 94    ''' <summary>
 95    ''' Has the Initialization process happened?
 96    ''' This is used to prevent multiple initializations.
 97    ''' </summary>
 98    Private _isInitialized As Boolean
 99
 100    ''' <summary>
 101    ''' is initializing
 102    ''' </summary>
 103    Private _isInitializing As Boolean
 104
 105    ''' <summary>
 106    ''' The initialization lock
 107    ''' </summary>
 12108    Private ReadOnly _initLock As New Object()
 109
 110    ''' <summary>
 111    ''' Initializes this instance.
 112    ''' </summary>
 15510113    Private Sub Initialize()
 114
 46152115        If _isInitialized OrElse _isInitializing Then Return
 756116        _isInitializing = True
 1134117        SyncLock _initLock
 378118            Try
 756119                If Not _isInitialized Then
 756120                    MachineName = GetAppSetting("EventLogHelper.MachineName", MachineName)
 756121                    LogName = GetAppSetting("EventLogHelper.LogName", LogName)
 756122                    SourceName = GetAppSetting("EventLogHelper.SourceName", SourceName)
 756123                    MaxKilobytes = GetAppSetting("EventLogHelper.MaxKilobytes", MaxKilobytes)
 756124                    RetentionDays = GetAppSetting("EventLogHelper.RetentionDays", RetentionDays)
 756125                    WriteInitEntry = GetAppSetting("EventLogHelper.WriteInitEntry", WriteInitEntry)
 756126                    TruncationMarker = GetAppSetting("EventLogHelper.TruncationMarker", TruncationMarker)
 756127                    ContinuationMarker = GetAppSetting("EventLogHelper.ContinuationMarker", ContinuationMarker)
 756128                    AllowMultiEntryMessages = GetAppSetting("EventLogHelper.AllowMultiEntryMessages", AllowMultiEntryMes
 756129                    IncludeSourceInMessage = GetAppSetting("EventLogHelper.IncludeSourceInMessage", IncludeSourceInMessa
 756130                    CurrentLoggingLevel = GetAppSetting("EventLogHelper.CurrentLoggingLevel", CurrentLoggingLevel)
 756131                    LoggingSeverity = GetAppSetting("EventLogHelper.LoggingSeverity", LoggingSeverity)
 756132                    SourceResolutionBehavior = GetAppSetting("EventLogHelper.SourceResolutionBehavior", SourceResolution
 133
 756134                    _isInitialized = True
 1134135                End If
 378136            Finally
 756137                _isInitializing = False
 378138            End Try
 1134139        End SyncLock
 140
 31020141    End Sub
 142
 143    ''' <summary>
 144    ''' Reads configuration values from <c>App.config</c>, <c>Web.config</c>, or
 145    ''' <c>appsettings.json</c> (depending on the target framework) and applies
 146    ''' them to <see cref="SmartEventLogger"/> defaults.
 147    ''' </summary>
 148    ''' <remarks>
 149    ''' <para>
 150    ''' This method reads predefined settings from the application's configuration and
 151    ''' applies them to the corresponding <see cref="SmartEventLogger"/> properties.
 152    ''' If a configuration value is not found, the property's existing value is retained.
 153    ''' </para>
 154    ''' <para>
 155    ''' Calling this method explicitly is optional. Configuration will also be loaded
 156    ''' automatically the first time a public method or property is accessed, unless it
 157    ''' has already been initialized.
 158    ''' </para>
 159    ''' <para>
 160    ''' Thread-safe: Initialization is guaranteed to run only once, even if called
 161    ''' concurrently from multiple threads.
 162    ''' </para>
 163    '''
 164    ''' <para>
 165    ''' Recognized configuration keys:
 166    ''' </para>
 167    ''' <list type="table">
 168    '''   <listheader>
 169    '''     <term>Key</term>
 170    '''     <description>Description</description>
 171    '''   </listheader>
 172    '''
 173    '''   <item>
 174    '''     <term>EventLogHelper.MachineName</term>
 175    '''     <description>
 176    ''' The name of the machine where the event log resides. Use <c>"."</c> for the local machine.
 177    ''' Defaults to the current value of <see cref="MachineName"/> (normally ".").
 178    ''' </description>
 179    '''   </item>
 180    '''
 181    '''   <item>
 182    '''     <term>EventLogHelper.LogName</term>
 183    '''     <description>
 184    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log).
 185    ''' Defaults to the current value of <see cref="LogName"/> (normally "Application").
 186    ''' </description>
 187    '''   </item>
 188    '''
 189    '''   <item>
 190    '''     <term>EventLogHelper.SourceName</term>
 191    '''     <description>
 192    ''' The event source name associated with log entries. If not provided, a name is automatically
 193    ''' generated from the calling method's namespace, class, and method name. Defaults to
 194    ''' the current value of <see cref="SourceName"/>.
 195    ''' </description>
 196    '''   </item>
 197    '''
 198    '''   <item>
 199    '''     <term>EventLogHelper.MaxKilobytes</term>
 200    '''     <description>
 201    ''' The maximum size of the event log in kilobytes when creating a new log.
 202    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 203    ''' Defaults to the current value of <see cref="MaxKilobytes"/> (normally 0).
 204    ''' </description>
 205    '''   </item>
 206    '''
 207    '''   <item>
 208    '''     <term>EventLogHelper.RetentionDays</term>
 209    '''     <description>
 210    ''' The number of days to retain event log entries when creating a new log.
 211    ''' If 0, events are retained indefinitely.
 212    ''' Defaults to the current value of <see cref="RetentionDays"/> (normally 0).
 213    ''' </description>
 214    '''   </item>
 215    '''
 216    '''   <item>
 217    '''     <term>EventLogHelper.WriteInitEntry</term>
 218    '''     <description>
 219    ''' Indicates whether to write an initialization entry to the log when a new log is created.
 220    ''' Defaults to the current value of <see cref="WriteInitEntry"/> (normally True).
 221    ''' </description>
 222    '''   </item>
 223    '''
 224    '''   <item>
 225    '''     <term>EventLogHelper.TruncationMarker</term>
 226    '''     <description>
 227    ''' The string appended to messages that are truncated due to exceeding the 32,766-character limit.
 228    ''' Defaults to the current value of <see cref="TruncationMarker"/> (normally "... [TRUNCATED]").
 229    ''' </description>
 230    '''   </item>
 231    '''
 232    '''   <item>
 233    '''     <term>EventLogHelper.ContinuationMarker</term>
 234    '''     <description>
 235    ''' The string appended to all but the last chunk of a message when multi-entry logging is enabled.
 236    ''' Defaults to the current value of <see cref="ContinuationMarker"/> (normally " ...").
 237    ''' </description>
 238    '''   </item>
 239    '''
 240    '''   <item>
 241    '''     <term>EventLogHelper.AllowMultiEntryMessages</term>
 242    '''     <description>
 243    ''' Indicates whether messages longer than 32,766 characters should be split into multiple
 244    ''' sequential entries instead of being truncated. Defaults to the current value of
 245    ''' <see cref="AllowMultiEntryMessages"/> (normally False).
 246    ''' </description>
 247    '''   </item>
 248    '''
 249    ''' </list>
 250    ''' </remarks>
 12251    Public Sub InitializeConfiguration()
 252
 24253        Initialize()
 254
 24255    End Sub
 256
 257    ''' <summary>
 258    ''' Resets this instance.
 259    ''' </summary>
 444260    Friend Sub Reset()
 261
 262        ' Reset all configuration settings to their default values
 888263        _machineName = "."
 888264        _logName = "Application"
 888265        _sourceName = ""
 888266        _maxKilobytes = 1024 * 1024
 888267        _retentionDays = 7
 888268        _writeInitEntry = False
 888269        _IncludeSourceInMessage = True
 888270        _truncationMarker = "... [TRUNCATED]"
 888271        _continuationMarker = " ..."
 888272        _allowMultiEntryMessages = False
 888273        _CurrentLoggingLevel = LoggingLevel.Verbose
 888274        _LoggingSeverity = LoggingSeverity.Info
 888275        _sourceResolutionBehavior = SourceResolutionBehavior.Strict
 888276        _writer = New RealEventLogWriter()
 888277        _registryReader = New RealRegistryReader()
 888278        FileSystem = New RealFileSystemShim()
 888279        Config = New RealConfigShim()
 888280        JsonSettingsFile = "appsettings.json"
 888281        _isInitialized = False
 888282        _isInitializing = False
 283
 888284    End Sub
 285
 286#End Region
 287
 288#Region " Backing Fields ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 289
 290    ''' <summary>
 291    ''' The machine name
 292    ''' </summary>
 12293    Private _machineName As String = "."
 294    ''' <summary>
 295    ''' The log name
 296    ''' </summary>
 12297    Private _logName As String = "Application"
 298    ''' <summary>
 299    ''' The source name
 300    ''' </summary>
 12301    Private _sourceName As String = ""
 302    ''' <summary>
 303    ''' The maximum kilobytes
 304    ''' </summary>
 12305    Private _maxKilobytes As Integer = 1024 * 1024
 306    ''' <summary>
 307    ''' The retention days
 308    ''' </summary>
 12309    Private _retentionDays As Integer = 7
 310    ''' <summary>
 311    ''' The write initialize entry
 312    ''' </summary>
 313    Private _writeInitEntry As Boolean
 314    ''' <summary>
 315    ''' The truncation marker
 316    ''' </summary>
 12317    Private _truncationMarker As String = "... [TRUNCATED]"
 318    ''' <summary>
 319    ''' The continuation marker
 320    ''' </summary>
 12321    Private _continuationMarker As String = " ..."
 322    ''' <summary>
 323    ''' The allow multi entry messages
 324    ''' </summary>
 325    Private _allowMultiEntryMessages As Boolean
 326    ''' <summary>
 327    ''' include the source in message
 328    ''' </summary>
 12329    Private _IncludeSourceInMessage As Boolean = True
 330    ''' <summary>
 331    ''' The current logging level
 332    ''' </summary>
 12333    Private _CurrentLoggingLevel As LoggingLevel = LoggingLevel.Verbose
 334    ''' <summary>
 335    ''' The logging severity
 336    ''' </summary>
 12337    Private _LoggingSeverity As LoggingSeverity = LoggingSeverity.Info
 338    ''' <summary>
 339    ''' the source resolution behavior.
 340    ''' </summary>
 12341    Private _sourceResolutionBehavior As SourceResolutionBehavior = SourceResolutionBehavior.Strict
 342
 343#End Region
 344
 345#Region " Default Value Properties ^^^^^^^^^^^^^^^^^^^^^^^^ "
 346
 347    ''' <summary>
 348    ''' Gets or sets the name of the machine where log entries will be written.
 349    ''' </summary>
 350    ''' <value>
 351    ''' A string representing the machine name. Use <c>"."</c> for the local machine.
 352    ''' </value>
 353    Public Property MachineName As String
 354
 978355        Get
 356
 1956357            Initialize()
 1956358            Return _machineName
 359
 1956360        End Get
 420361        Set
 362
 840363            Initialize()
 840364            _machineName = Value
 365
 840366        End Set
 367
 368    End Property
 369
 370    ''' <summary>
 371    ''' Gets or sets the name of the Windows Event Log to write to (e.g., "Application", "System").
 372    ''' </summary>
 373    ''' <value>
 374    ''' A string specifying the log name. Defaults to <c>"Application"</c>.
 375    ''' </value>
 376    Public Property LogName As String
 377
 654378        Get
 379
 1308380            Initialize()
 1308381            Return _logName
 382
 1308383        End Get
 384384        Set
 385
 768386            Initialize()
 768387            _logName = Value
 388
 768389        End Set
 390
 391    End Property
 392
 393    ''' <summary>
 394    ''' Gets or sets the name of the event source associated with log entries.
 395    ''' </summary>
 396    ''' <value>
 397    ''' A string representing the source name. If not set, a source is inferred automatically using the calling method's
 398    ''' </value>
 399    Public Property SourceName As String
 400
 600401        Get
 402
 1200403            Initialize()
 1200404            Return _sourceName
 405
 1200406        End Get
 402407        Set
 408
 804409            Initialize()
 804410            _sourceName = Value
 411
 804412        End Set
 413
 414    End Property
 415
 416    ''' <summary>
 417    ''' Gets or sets the maximum allowed size of the event log in kilobytes.
 418    ''' </summary>
 419    ''' <value>
 420    ''' An integer representing the size in kilobytes. Defaults to <c>1,048,576</c> (1 GB).
 421    ''' </value>
 422    ''' <remarks>
 423    ''' Applies only when creating or configuring new custom logs. May require administrative privileges.
 424    ''' </remarks>
 425    Public Property MaxKilobytes As Integer
 426
 708427        Get
 428
 1416429            Initialize()
 1416430            Return _maxKilobytes
 431
 1416432        End Get
 384433        Set
 434
 768435            Initialize()
 768436            _maxKilobytes = Value
 437
 768438        End Set
 439
 440    End Property
 441
 442    ''' <summary>
 443    ''' Gets or sets the number of days event entries are retained before being overwritten.
 444    ''' </summary>
 445    ''' <value>
 446    ''' An integer representing the retention duration in days. Defaults to <c>7</c>.
 447    ''' </value>
 448    ''' <remarks>
 449    ''' Used when initializing a new event log. May be ignored depending on overflow policy or system restrictions.
 450    ''' </remarks>
 451    Public Property RetentionDays As Integer
 452
 714453        Get
 454
 1428455            Initialize()
 1428456            Return _retentionDays
 457
 1428458        End Get
 384459        Set
 460
 768461            Initialize()
 768462            _retentionDays = Value
 463
 768464        End Set
 465
 466    End Property
 467
 468    ''' <summary>
 469    ''' Gets or sets a value indicating whether an informational entry should be written when a new log is created.
 470    ''' </summary>
 471    ''' <value>
 472    ''' <c>True</c> to log an initialization message; otherwise, <c>False</c>. Defaults to <c>False</c>.
 473    ''' </value>
 474    Public Property WriteInitEntry As Boolean
 475
 726476        Get
 477
 1452478            Initialize()
 1452479            Return _writeInitEntry
 480
 1452481        End Get
 384482        Set
 483
 768484            Initialize()
 768485            _writeInitEntry = Value
 486
 768487        End Set
 488
 489    End Property
 490
 491    ''' <summary>
 492    ''' Gets or sets the marker text used when a message is too long and must be truncated.
 493    ''' </summary>
 494    ''' <value>
 495    ''' A string appended to truncated log entries. Defaults to <c>"... [TRUNCATED]"</c>.
 496    ''' </value>
 497    Public Property TruncationMarker As String
 498
 1002499        Get
 500
 2004501            Initialize()
 2004502            Return _truncationMarker
 503
 2004504        End Get
 390505        Set
 506
 780507            Initialize()
 780508            _truncationMarker = Value
 509
 780510        End Set
 511
 512    End Property
 513
 514    ''' <summary>
 515    ''' Gets or sets the continuation marker used when splitting long messages
 516    ''' across multiple event log entries.
 517    ''' </summary>
 518    ''' <value>
 519    ''' The string appended to each intermediate log entry when
 520    ''' <see cref="AllowMultiEntryMessages"/> is <c>true</c>.
 521    ''' Defaults to <c>" ..."</c>.
 522    ''' This value is ignored if message splitting is disabled.
 523    ''' </value>
 524    ''' <remarks>
 525    ''' The marker is added to all chunks except the final one to indicate the
 526    ''' message continues in the next log entry. Make sure the marker is short
 527    ''' enough to allow meaningful message content within the 32,766-character
 528    ''' limit of the Event Log.
 529    ''' </remarks>
 530    Public Property ContinuationMarker As String
 531
 396532        Get
 533
 792534            Initialize()
 792535            Return _continuationMarker
 536
 792537        End Get
 396538        Set
 539
 792540            Initialize()
 792541            _continuationMarker = Value
 542
 792543        End Set
 544
 545    End Property
 546
 547    ''' <summary>
 548    ''' Gets or sets a value indicating whether messages that exceed the Event Log
 549    ''' length limit should be split across multiple entries.
 550    ''' </summary>
 551    ''' <value>
 552    ''' <c>true</c> to split long messages into multiple event log entries;
 553    ''' <c>false</c> to truncate long messages and append a truncation notice.
 554    ''' Default is <c>false</c>.
 555    ''' </value>
 556    ''' <remarks>
 557    ''' When enabled, messages exceeding 32,766 characters are split into sequential entries,
 558    ''' each prefixed with a part number and optionally suffixed with a continuation marker
 559    ''' (see <see cref="ContinuationMarker"/>). This preserves the full message without truncation.
 560    '''
 561    ''' When disabled, long messages are truncated to fit within the Event Log limit,
 562    ''' and the truncation marker (e.g., <c>"... [TRUNCATED]"</c>) is appended.
 563    ''' </remarks>
 564    Public Property AllowMultiEntryMessages As Boolean
 565
 714566        Get
 567
 1428568            Initialize()
 1428569            Return _allowMultiEntryMessages
 570
 1428571        End Get
 486572        Set
 573
 972574            Initialize()
 972575            _allowMultiEntryMessages = Value
 576
 972577        End Set
 578
 579    End Property
 580
 581    ''' <summary>
 582    ''' Gets a value indicating whether this instance is initialized.
 583    ''' </summary>
 584    ''' <value>
 585    '''   <c>true</c> if this instance is initialized; otherwise, <c>false</c>.
 586    ''' </value>
 587    Public ReadOnly Property IsInitialized As Boolean
 588
 6589        Get
 12590            Return _isInitialized
 591
 12592        End Get
 593
 594    End Property
 595
 596    ''' <summary>
 597    ''' Gets or sets a value indicating whether to include the source in the message.
 598    ''' </summary>
 599    ''' <value>
 600    '''   <c>true</c> if the source should be included in the message; otherwise, <c>false</c>.
 601    ''' </value>
 602    Public Property IncludeSourceInMessage As Boolean
 414603        Get
 828604            Initialize()
 828605            Return _IncludeSourceInMessage
 828606        End Get
 390607        Set
 780608            Initialize()
 780609            _IncludeSourceInMessage = Value
 780610        End Set
 611    End Property
 612
 613    ''' <summary>
 614    ''' Gets or sets the minimum <see cref="LoggingLevel"/> that must be met
 615    ''' for log entries to be written.
 616    ''' </summary>
 617    ''' <value>
 618    ''' The currently active logging level. Entries with a severity below this level
 619    ''' will be ignored. Defaults to <see cref="LoggingLevel.Normal"/>.
 620    ''' </value>
 621    ''' <remarks>
 622    ''' This property acts as a global filter to increase or decrease the verbosity
 623    ''' of logging at runtime. For example, setting this to
 624    ''' <see cref="LoggingLevel.Verbose"/> allows all entries to be logged, while
 625    ''' <see cref="LoggingLevel.Minimal"/> ensures only warnings, errors, and critical
 626    ''' entries are written.
 627    ''' </remarks>
 628    Public Property CurrentLoggingLevel As LoggingLevel
 629
 786630        Get
 631
 1572632            Initialize()
 1572633            Return _CurrentLoggingLevel
 634
 1572635        End Get
 498636        Set
 637
 996638            Initialize()
 996639            _CurrentLoggingLevel = Value
 640
 996641        End Set
 642
 643    End Property
 644
 645    ''' <summary>
 646    ''' Gets or sets the default <see cref="LoggingSeverity"/> applied to log entries
 647    ''' when no explicit severity is specified.
 648    ''' </summary>
 649    ''' <value>
 650    ''' The default severity level for new log entries. Defaults to
 651    ''' <see cref="LoggingSeverity.Info"/>.
 652    ''' </value>
 653    ''' <remarks>
 654    ''' This property determines the baseline importance assigned to entries that do
 655    ''' not specify a severity. For example, a call such as
 656    ''' <c>SmartEventLogger.Log("Started service.")</c> will use this value.
 657    ''' Combined with <see cref="CurrentLoggingLevel"/>, it controls whether the
 658    ''' entry is written or ignored.
 659    ''' </remarks>
 660    Public Property LoggingSeverity As LoggingSeverity
 661
 528662        Get
 663
 1056664            Initialize()
 1056665            Return _LoggingSeverity
 666
 1056667        End Get
 378668        Set
 669
 756670            Initialize()
 756671            _LoggingSeverity = Value
 672
 756673        End Set
 674
 675    End Property
 676
 677    ''' <summary>
 678    ''' Gets or sets the strategy used when resolving event sources that are
 679    ''' registered under a different log than the one requested.
 680    ''' </summary>
 681    ''' <value>
 682    ''' A <see cref="SourceResolutionBehavior"/> value that determines whether logging
 683    ''' requires an exact source-to-log match (<c>Strict</c>), automatically switches
 684    ''' to the log where the source is registered (<c>UseSourceLog</c>), or creates a
 685    ''' new source under the requested log (<c>CreateNewSource</c>).
 686    ''' </value>
 687    ''' <remarks>
 688    ''' This setting controls how <see cref="SmartEventLogger"/> handles cases where
 689    ''' the requested source and log are not aligned, which can occur on
 690    ''' misconfigured systems or when reusing existing event sources.
 691    ''' </remarks>
 692    Public Property SourceResolutionBehavior As SourceResolutionBehavior
 693
 378694        Get
 695
 756696            Initialize()
 756697            Return _sourceResolutionBehavior
 698
 756699        End Get
 390700        Set
 701
 780702            Initialize()
 780703            _sourceResolutionBehavior = Value
 704
 780705        End Set
 706
 707    End Property
 708
 709    ''' <summary>
 710    ''' Gets or sets the file system.
 711    ''' </summary>
 712    ''' <value>
 713    ''' The file system.
 714    ''' </value>
 12715    Friend Property FileSystem As IFileSystemShim = New RealFileSystemShim()
 716
 717    ''' <summary>
 718    ''' Gets or sets the configuration.
 719    ''' </summary>
 720    ''' <value>
 721    ''' The configuration.
 722    ''' </value>
 12723    Friend Property Config As IConfigShim = New RealConfigShim()
 724
 725    ''' <summary>
 726    ''' Gets or sets the JSON settings file name to check for configuration.
 727    ''' Defaults to "appsettings.json".
 728    ''' </summary>
 12729    Friend Property JsonSettingsFile As String = "appsettings.json"
 730
 731#End Region
 732
 733#Region " Log Methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 734
 735    ''' <summary>
 736    ''' Writes an entry to the Windows Event Log using the provided parameters.
 737    ''' </summary>
 738    ''' <param name="message">
 739    ''' The message to log. If <c>null</c> or empty, a default message is used.
 740    '''
 741    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 742    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 743    '''
 744    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 745    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 746    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 747    ''' </param>
 748    ''' <remarks>
 749    ''' <para>
 750    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 751    ''' </para>
 752    ''' <para>
 753    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 754    ''' </para>
 755    ''' </remarks>
 12756    Public Sub Log(
 12757            ByVal message As String)
 758
 24759        Log("",
 24760            "",
 24761            message)
 762
 24763    End Sub
 764
 765    ''' <summary>
 766    ''' Writes an entry to the Windows Event Log using the provided parameters.
 767    ''' </summary>
 768    ''' <param name="message">
 769    ''' The message to log. If <c>null</c> or empty, a default message is used.
 770    '''
 771    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 772    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 773    '''
 774    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 775    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 776    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 777    ''' </param>
 778    ''' <param name="EntrySeverity">
 779    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 780    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 781    ''' will be skipped and not written to the Event Log.
 782    ''' </param>
 783    ''' <remarks>
 784    ''' <para>
 785    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 786    ''' </para>
 787    ''' <para>
 788    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 789    ''' </para>
 790    ''' </remarks>
 30791    Public Sub Log(
 30792            ByVal message As String,
 30793            ByVal EntrySeverity As LoggingSeverity)
 794
 60795        Log("",
 60796            "",
 60797            message,
 60798            EntrySeverity)
 799
 60800    End Sub
 801
 802    ''' <summary>
 803    ''' Writes an entry to the Windows Event Log using the provided parameters.
 804    ''' </summary>
 805    ''' <param name="source">
 806    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 807    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 808    ''' </param>
 809    ''' <param name="message">
 810    ''' The message to log. If <c>null</c> or empty, a default message is used.
 811    '''
 812    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 813    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 814    '''
 815    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 816    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 817    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 818    ''' </param>
 819    ''' <remarks>
 820    ''' <para>
 821    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 822    ''' </para>
 823    ''' <para>
 824    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 825    ''' </para>
 826    ''' </remarks>
 6827    Public Sub Log(
 6828            ByVal source As String,
 6829            ByVal message As String)
 830
 12831        Log("",
 12832            source,
 12833            message)
 834
 12835    End Sub
 836
 837    ''' <summary>
 838    ''' Writes an entry to the Windows Event Log using the provided parameters.
 839    ''' </summary>
 840    ''' <param name="source">
 841    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 842    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 843    ''' </param>
 844    ''' <param name="message">
 845    ''' The message to log. If <c>null</c> or empty, a default message is used.
 846    '''
 847    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 848    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 849    '''
 850    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 851    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 852    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 853    ''' </param>
 854    ''' <param name="EntrySeverity">
 855    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 856    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 857    ''' will be skipped and not written to the Event Log.
 858    ''' </param>
 859    ''' <remarks>
 860    ''' <para>
 861    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 862    ''' </para>
 863    ''' <para>
 864    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 865    ''' </para>
 866    ''' </remarks>
 6867    Public Sub Log(
 6868            ByVal source As String,
 6869            ByVal message As String,
 6870            ByVal EntrySeverity As LoggingSeverity)
 871
 12872        Log("",
 12873            source,
 12874            message,
 12875            EntrySeverity)
 876
 12877    End Sub
 878
 879    ''' <summary>
 880    ''' Writes an entry to the Windows Event Log using the provided parameters.
 881    ''' </summary>
 882    ''' <param name="message">
 883    ''' The message to log. If <c>null</c> or empty, a default message is used.
 884    '''
 885    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 886    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 887    '''
 888    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 889    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 890    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 891    ''' </param>
 892    ''' <param name="eventType">
 893    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 894    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 895    ''' </param>
 896    ''' <remarks>
 897    ''' <para>
 898    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 899    ''' </para>
 900    ''' <para>
 901    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 902    ''' </para>
 903    ''' </remarks>
 6904    Public Sub Log(
 6905            ByVal message As String,
 6906            ByVal eventType As EventLogEntryType)
 907
 12908        Log("",
 12909            message,
 12910            eventType)
 911
 12912    End Sub
 913
 914    ''' <summary>
 915    ''' Writes an entry to the Windows Event Log using the provided parameters.
 916    ''' </summary>
 917    ''' <param name="message">
 918    ''' The message to log. If <c>null</c> or empty, a default message is used.
 919    '''
 920    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 921    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 922    '''
 923    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 924    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 925    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 926    ''' </param>
 927    ''' <param name="eventType">
 928    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 929    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 930    ''' </param>
 931    ''' <param name="EntrySeverity">
 932    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 933    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 934    ''' will be skipped and not written to the Event Log.
 935    ''' </param>
 936    ''' <remarks>
 937    ''' <para>
 938    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 939    ''' </para>
 940    ''' <para>
 941    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 942    ''' </para>
 943    ''' </remarks>
 6944    Public Sub Log(
 6945            ByVal message As String,
 6946            ByVal eventType As EventLogEntryType,
 6947            ByVal EntrySeverity As LoggingSeverity)
 948
 12949        Log("",
 12950            message,
 12951            eventType,
 12952            EntrySeverity)
 953
 12954    End Sub
 955
 956    ''' <summary>
 957    ''' Writes an entry to the Windows Event Log using the provided parameters.
 958    ''' </summary>
 959    ''' <param name="logName">
 960    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 961    ''' If <c>null</c> or empty, "Application" is used by default.
 962    ''' </param>
 963    ''' <param name="sourceName">
 964    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 965    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 966    ''' </param>
 967    ''' <param name="message">
 968    ''' The message to log. If <c>null</c> or empty, a default message is used.
 969    '''
 970    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 971    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 972    '''
 973    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 974    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 975    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 976    ''' </param>
 977    ''' <remarks>
 978    ''' <para>
 979    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 980    ''' </para>
 981    ''' <para>
 982    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 983    ''' </para>
 984    ''' </remarks>
 24985    Public Sub Log(
 24986            ByVal logName As String,
 24987            ByVal sourceName As String,
 24988            ByVal message As String)
 989
 48990        Log(logName,
 48991            sourceName,
 48992            message,
 48993            EventLogEntryType.Information)
 994
 48995    End Sub
 996
 997    ''' <summary>
 998    ''' Writes an entry to the Windows Event Log using the provided parameters.
 999    ''' </summary>
 1000    ''' <param name="logName">
 1001    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1002    ''' If <c>null</c> or empty, "Application" is used by default.
 1003    ''' </param>
 1004    ''' <param name="sourceName">
 1005    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1006    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1007    ''' </param>
 1008    ''' <param name="message">
 1009    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1010    '''
 1011    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1012    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1013    '''
 1014    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1015    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1016    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1017    ''' </param>
 1018    ''' <param name="EntrySeverity">
 1019    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1020    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1021    ''' will be skipped and not written to the Event Log.
 1022    ''' </param>
 1023    ''' <remarks>
 1024    ''' <para>
 1025    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1026    ''' </para>
 1027    ''' <para>
 1028    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1029    ''' </para>
 1030    ''' </remarks>
 361031    Public Sub Log(
 361032            ByVal logName As String,
 361033            ByVal sourceName As String,
 361034            ByVal message As String,
 361035            ByVal EntrySeverity As LoggingSeverity)
 1036
 721037        Log(logName,
 721038            sourceName,
 721039            message,
 721040            EventLogEntryType.Information,
 721041            EntrySeverity)
 1042
 721043    End Sub
 1044
 1045    ''' <summary>
 1046    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1047    ''' </summary>
 1048    ''' <param name="sourceName">
 1049    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1050    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1051    ''' </param>
 1052    ''' <param name="message">
 1053    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1054    '''
 1055    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1056    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1057    '''
 1058    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1059    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1060    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1061    ''' </param>
 1062    ''' <param name="eventType">
 1063    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1064    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1065    ''' </param>
 1066    ''' <remarks>
 1067    ''' <para>
 1068    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1069    ''' </para>
 1070    ''' <para>
 1071    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1072    ''' </para>
 1073    ''' </remarks>
 121074    Public Sub Log(
 121075            ByVal sourceName As String,
 121076            ByVal message As String,
 121077            ByVal eventType As EventLogEntryType)
 1078
 241079        Log("",
 241080            sourceName,
 241081            message,
 241082            eventType)
 1083
 241084    End Sub
 1085
 1086    ''' <summary>
 1087    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1088    ''' </summary>
 1089    ''' <param name="sourceName">
 1090    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1091    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1092    ''' </param>
 1093    ''' <param name="message">
 1094    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1095    '''
 1096    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1097    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1098    '''
 1099    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1100    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1101    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1102    ''' </param>
 1103    ''' <param name="eventType">
 1104    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1105    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1106    ''' </param>
 1107    ''' <param name="EntrySeverity">
 1108    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1109    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1110    ''' will be skipped and not written to the Event Log.
 1111    ''' </param>
 1112    ''' <remarks>
 1113    ''' <para>
 1114    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1115    ''' </para>
 1116    ''' <para>
 1117    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1118    ''' </para>
 1119    ''' </remarks>
 61120    Public Sub Log(
 61121            ByVal sourceName As String,
 61122            ByVal message As String,
 61123            ByVal eventType As EventLogEntryType,
 61124            ByVal EntrySeverity As LoggingSeverity)
 1125
 121126        Log("",
 121127            sourceName,
 121128            message,
 121129            eventType,
 121130            EntrySeverity)
 1131
 121132    End Sub
 1133
 1134    ''' <summary>
 1135    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1136    ''' </summary>
 1137    ''' <param name="logName">
 1138    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1139    ''' If <c>null</c> or empty, "Application" is used by default.
 1140    ''' </param>
 1141    ''' <param name="sourceName">
 1142    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1143    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1144    ''' </param>
 1145    ''' <param name="message">
 1146    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1147    '''
 1148    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1149    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1150    '''
 1151    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1152    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1153    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1154    ''' </param>
 1155    ''' <param name="eventType">
 1156    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1157    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1158    ''' </param>
 1159    ''' <remarks>
 1160    ''' <para>
 1161    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1162    ''' </para>
 1163    ''' <para>
 1164    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1165    ''' </para>
 1166    ''' </remarks>
 421167    Public Sub Log(
 421168            ByVal logName As String,
 421169            ByVal sourceName As String,
 421170            ByVal message As String,
 421171            ByVal eventType As EventLogEntryType)
 1172
 841173        Log(logName,
 841174            sourceName,
 841175            message,
 841176            eventType,
 841177            0)
 1178
 841179    End Sub
 1180
 1181    ''' <summary>
 1182    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1183    ''' </summary>
 1184    ''' <param name="logName">
 1185    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1186    ''' If <c>null</c> or empty, "Application" is used by default.
 1187    ''' </param>
 1188    ''' <param name="sourceName">
 1189    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1190    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1191    ''' </param>
 1192    ''' <param name="message">
 1193    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1194    '''
 1195    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1196    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1197    '''
 1198    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1199    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1200    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1201    ''' </param>
 1202    ''' <param name="eventType">
 1203    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1204    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1205    ''' </param>
 1206    ''' <param name="EntrySeverity">
 1207    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1208    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1209    ''' will be skipped and not written to the Event Log.
 1210    ''' </param>
 1211    ''' <remarks>
 1212    ''' <para>
 1213    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1214    ''' </para>
 1215    ''' <para>
 1216    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1217    ''' </para>
 1218    ''' </remarks>
 421219    Public Sub Log(
 421220            ByVal logName As String,
 421221            ByVal sourceName As String,
 421222            ByVal message As String,
 421223            ByVal eventType As EventLogEntryType,
 421224            ByVal EntrySeverity As LoggingSeverity)
 1225
 841226        Log(logName,
 841227            sourceName,
 841228            message,
 841229            eventType,
 841230            0,
 841231            EntrySeverity)
 1232
 841233    End Sub
 1234
 1235    ''' <summary>
 1236    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1237    ''' </summary>
 1238    ''' <param name="message">
 1239    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1240    '''
 1241    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1242    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1243    '''
 1244    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1245    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1246    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1247    ''' </param>
 1248    ''' <param name="eventType">
 1249    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1250    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1251    ''' </param>
 1252    ''' <param name="eventID">
 1253    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1254    ''' </param>
 1255    ''' <remarks>
 1256    ''' <para>
 1257    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1258    ''' </para>
 1259    ''' <para>
 1260    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1261    ''' </para>
 1262    ''' </remarks>
 61263    Public Sub Log(
 61264            ByVal message As String,
 61265            ByVal eventType As EventLogEntryType,
 61266            ByVal eventID As Integer)
 1267
 121268        Log("",
 121269            message,
 121270            eventType,
 121271            eventID)
 1272
 121273    End Sub
 1274
 1275    ''' <summary>
 1276    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1277    ''' </summary>
 1278    ''' <param name="message">
 1279    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1280    '''
 1281    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1282    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1283    '''
 1284    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1285    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1286    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1287    ''' </param>
 1288    ''' <param name="eventType">
 1289    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1290    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1291    ''' </param>
 1292    ''' <param name="eventID">
 1293    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1294    ''' </param>
 1295    ''' <param name="EntrySeverity">
 1296    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1297    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1298    ''' will be skipped and not written to the Event Log.
 1299    ''' </param>
 1300    ''' <remarks>
 1301    ''' <para>
 1302    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1303    ''' </para>
 1304    ''' <para>
 1305    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1306    ''' </para>
 1307    ''' </remarks>
 61308    Public Sub Log(
 61309            ByVal message As String,
 61310            ByVal eventType As EventLogEntryType,
 61311            ByVal eventID As Integer,
 61312            ByVal EntrySeverity As LoggingSeverity)
 1313
 121314        Log("",
 121315            message,
 121316            eventType,
 121317            eventID,
 121318            EntrySeverity)
 1319
 121320    End Sub
 1321
 1322    ''' <summary>
 1323    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1324    ''' </summary>
 1325    ''' <param name="sourceName">
 1326    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1327    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1328    ''' </param>
 1329    ''' <param name="message">
 1330    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1331    '''
 1332    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1333    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1334    '''
 1335    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1336    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1337    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1338    ''' </param>
 1339    ''' <param name="eventType">
 1340    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1341    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1342    ''' </param>
 1343    ''' <param name="eventID">
 1344    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1345    ''' </param>
 1346    ''' <remarks>
 1347    ''' <para>
 1348    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1349    ''' </para>
 1350    ''' <para>
 1351    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1352    ''' </para>
 1353    ''' </remarks>
 61354    Public Sub Log(
 61355            ByVal sourceName As String,
 61356            ByVal message As String,
 61357            ByVal eventType As EventLogEntryType,
 61358            ByVal eventID As Integer)
 1359
 121360        Log("",
 121361            sourceName,
 121362            message,
 121363            eventType,
 121364            eventID)
 1365
 121366    End Sub
 1367
 1368    ''' <summary>
 1369    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1370    ''' </summary>
 1371    ''' <param name="sourceName">
 1372    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1373    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1374    ''' </param>
 1375    ''' <param name="message">
 1376    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1377    '''
 1378    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1379    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1380    '''
 1381    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1382    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1383    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1384    ''' </param>
 1385    ''' <param name="eventType">
 1386    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1387    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1388    ''' </param>
 1389    ''' <param name="eventID">
 1390    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1391    ''' </param>
 1392    ''' <param name="EntrySeverity">
 1393    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1394    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1395    ''' will be skipped and not written to the Event Log.
 1396    ''' </param>
 1397    ''' <remarks>
 1398    ''' <para>
 1399    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1400    ''' </para>
 1401    ''' <para>
 1402    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1403    ''' </para>
 1404    ''' </remarks>
 61405    Public Sub Log(
 61406            ByVal sourceName As String,
 61407            ByVal message As String,
 61408            ByVal eventType As EventLogEntryType,
 61409            ByVal eventID As Integer,
 61410            ByVal EntrySeverity As LoggingSeverity)
 1411
 121412        Log("",
 121413            sourceName,
 121414            message,
 121415            eventType,
 121416            eventID,
 121417            EntrySeverity)
 1418
 121419    End Sub
 1420
 1421    ''' <summary>
 1422    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1423    ''' </summary>
 1424    ''' <param name="logName">
 1425    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1426    ''' If <c>null</c> or empty, "Application" is used by default.
 1427    ''' </param>
 1428    ''' <param name="sourceName">
 1429    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1430    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1431    ''' </param>
 1432    ''' <param name="message">
 1433    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1434    '''
 1435    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1436    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1437    '''
 1438    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1439    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1440    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1441    ''' </param>
 1442    ''' <param name="eventType">
 1443    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1444    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1445    ''' </param>
 1446    ''' <param name="eventID">
 1447    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1448    ''' </param>
 1449    ''' <remarks>
 1450    ''' <para>
 1451    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1452    ''' </para>
 1453    ''' <para>
 1454    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1455    ''' </para>
 1456    ''' </remarks>
 541457    Public Sub Log(
 541458            ByVal logName As String,
 541459            ByVal sourceName As String,
 541460            ByVal message As String,
 541461            ByVal eventType As EventLogEntryType,
 541462            ByVal eventID As Integer)
 1463
 1081464        Log(logName,
 1081465            sourceName,
 1081466            message,
 1081467            eventType,
 1081468            eventID,
 1081469            0)
 1470
 1081471    End Sub
 1472
 1473    ''' <summary>
 1474    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1475    ''' </summary>
 1476    ''' <param name="logName">
 1477    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1478    ''' If <c>null</c> or empty, "Application" is used by default.
 1479    ''' </param>
 1480    ''' <param name="sourceName">
 1481    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1482    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1483    ''' </param>
 1484    ''' <param name="message">
 1485    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1486    '''
 1487    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1488    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1489    '''
 1490    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1491    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1492    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1493    ''' </param>
 1494    ''' <param name="eventType">
 1495    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1496    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1497    ''' </param>
 1498    ''' <param name="eventID">
 1499    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1500    ''' </param>
 1501    ''' <param name="EntrySeverity">
 1502    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1503    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1504    ''' will be skipped and not written to the Event Log.
 1505    ''' </param>
 1506    ''' <remarks>
 1507    ''' <para>
 1508    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1509    ''' </para>
 1510    ''' <para>
 1511    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1512    ''' </para>
 1513    ''' </remarks>
 1021514    Public Sub Log(
 1021515            ByVal logName As String,
 1021516            ByVal sourceName As String,
 1021517            ByVal message As String,
 1021518            ByVal eventType As EventLogEntryType,
 1021519            ByVal eventID As Integer,
 1021520            ByVal EntrySeverity As LoggingSeverity)
 1521
 2041522        Log(logName,
 2041523            sourceName,
 2041524            message,
 2041525            eventType,
 2041526            eventID,
 2041527            0,
 2041528            EntrySeverity)
 1529
 2041530    End Sub
 1531
 1532    ''' <summary>
 1533    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1534    ''' </summary>
 1535    ''' <param name="message">
 1536    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1537    '''
 1538    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1539    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1540    '''
 1541    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1542    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1543    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1544    ''' </param>
 1545    ''' <param name="eventType">
 1546    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1547    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1548    ''' </param>
 1549    ''' <param name="eventID">
 1550    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1551    ''' </param>
 1552    ''' <param name="category">
 1553    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1554    ''' </param>
 1555    ''' <remarks>
 1556    ''' <para>
 1557    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1558    ''' </para>
 1559    ''' <para>
 1560    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1561    ''' </para>
 1562    ''' </remarks>
 61563    Public Sub Log(
 61564            ByVal message As String,
 61565            ByVal eventType As EventLogEntryType,
 61566            ByVal eventID As Integer,
 61567            ByVal category As Short)
 1568
 121569        Log("",
 121570            message,
 121571            eventType,
 121572            eventID,
 121573            category)
 1574
 121575    End Sub
 1576
 1577    ''' <summary>
 1578    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1579    ''' </summary>
 1580    ''' <param name="message">
 1581    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1582    '''
 1583    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1584    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1585    '''
 1586    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1587    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1588    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1589    ''' </param>
 1590    ''' <param name="eventType">
 1591    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1592    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1593    ''' </param>
 1594    ''' <param name="eventID">
 1595    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1596    ''' </param>
 1597    ''' <param name="category">
 1598    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1599    ''' </param>
 1600    ''' <param name="EntrySeverity">
 1601    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1602    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1603    ''' will be skipped and not written to the Event Log.
 1604    ''' </param>
 1605    ''' <remarks>
 1606    ''' <para>
 1607    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1608    ''' </para>
 1609    ''' <para>
 1610    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1611    ''' </para>
 1612    ''' </remarks>
 61613    Public Sub Log(
 61614            ByVal message As String,
 61615            ByVal eventType As EventLogEntryType,
 61616            ByVal eventID As Integer,
 61617            ByVal category As Short,
 61618            ByVal EntrySeverity As LoggingSeverity)
 1619
 121620        Log("",
 121621            message,
 121622            eventType,
 121623            eventID,
 121624            category,
 121625            EntrySeverity)
 1626
 121627    End Sub
 1628
 1629    ''' <summary>
 1630    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1631    ''' </summary>
 1632    ''' <param name="sourceName">
 1633    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1634    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1635    ''' </param>
 1636    ''' <param name="message">
 1637    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1638    '''
 1639    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1640    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1641    '''
 1642    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1643    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1644    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1645    ''' </param>
 1646    ''' <param name="eventType">
 1647    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1648    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1649    ''' </param>
 1650    ''' <param name="eventID">
 1651    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1652    ''' </param>
 1653    ''' <param name="category">
 1654    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1655    ''' </param>
 1656    ''' <remarks>
 1657    ''' <para>
 1658    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1659    ''' </para>
 1660    ''' <para>
 1661    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1662    ''' </para>
 1663    ''' </remarks>
 121664    Public Sub Log(
 121665            ByVal sourceName As String,
 121666            ByVal message As String,
 121667            ByVal eventType As EventLogEntryType,
 121668            ByVal eventID As Integer,
 121669            ByVal category As Short)
 1670
 241671        Log("",
 241672            sourceName,
 241673            message,
 241674            eventType,
 241675            eventID,
 241676            category)
 1677
 241678    End Sub
 1679
 1680    ''' <summary>
 1681    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1682    ''' </summary>
 1683    ''' <param name="sourceName">
 1684    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1685    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1686    ''' </param>
 1687    ''' <param name="message">
 1688    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1689    '''
 1690    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1691    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1692    '''
 1693    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1694    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1695    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1696    ''' </param>
 1697    ''' <param name="eventType">
 1698    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1699    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1700    ''' </param>
 1701    ''' <param name="eventID">
 1702    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1703    ''' </param>
 1704    ''' <param name="category">
 1705    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1706    ''' </param>
 1707    ''' <param name="EntrySeverity">
 1708    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1709    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1710    ''' will be skipped and not written to the Event Log.
 1711    ''' </param>
 1712    ''' <remarks>
 1713    ''' <para>
 1714    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1715    ''' </para>
 1716    ''' <para>
 1717    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1718    ''' </para>
 1719    ''' </remarks>
 61720    Public Sub Log(
 61721            ByVal sourceName As String,
 61722            ByVal message As String,
 61723            ByVal eventType As EventLogEntryType,
 61724            ByVal eventID As Integer,
 61725            ByVal category As Short,
 61726            ByVal EntrySeverity As LoggingSeverity)
 1727
 121728        Log("",
 121729            sourceName,
 121730            message,
 121731            eventType,
 121732            eventID,
 121733            category,
 121734            EntrySeverity)
 1735
 121736    End Sub
 1737
 1738    ''' <summary>
 1739    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1740    ''' </summary>
 1741    ''' <param name="logName">
 1742    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1743    ''' If <c>null</c> or empty, "Application" is used by default.
 1744    ''' </param>
 1745    ''' <param name="sourceName">
 1746    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1747    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1748    ''' </param>
 1749    ''' <param name="message">
 1750    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1751    '''
 1752    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1753    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1754    '''
 1755    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1756    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1757    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1758    ''' </param>
 1759    ''' <param name="eventType">
 1760    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1761    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1762    ''' </param>
 1763    ''' <param name="eventID">
 1764    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1765    ''' </param>
 1766    ''' <param name="category">
 1767    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1768    ''' </param>
 1769    ''' <remarks>
 1770    ''' <para>
 1771    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1772    ''' </para>
 1773    ''' <para>
 1774    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1775    ''' </para>
 1776    ''' </remarks>
 181777    Public Sub Log(
 181778            ByVal logName As String,
 181779            ByVal sourceName As String,
 181780            ByVal message As String,
 181781            ByVal eventType As EventLogEntryType,
 181782            ByVal eventID As Integer,
 181783            ByVal category As Short)
 1784
 361785        Log("",
 361786            logName,
 361787            sourceName,
 361788            message,
 361789            eventType,
 361790            eventID,
 361791            category,
 361792            Nothing)
 1793
 361794    End Sub
 1795
 1796    ''' <summary>
 1797    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1798    ''' </summary>
 1799    ''' <param name="logName">
 1800    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1801    ''' If <c>null</c> or empty, "Application" is used by default.
 1802    ''' </param>
 1803    ''' <param name="sourceName">
 1804    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1805    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1806    ''' </param>
 1807    ''' <param name="message">
 1808    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1809    '''
 1810    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1811    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1812    '''
 1813    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1814    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1815    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1816    ''' </param>
 1817    ''' <param name="eventType">
 1818    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1819    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1820    ''' </param>
 1821    ''' <param name="eventID">
 1822    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1823    ''' </param>
 1824    ''' <param name="category">
 1825    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1826    ''' </param>
 1827    ''' <param name="EntrySeverity">
 1828    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1829    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1830    ''' will be skipped and not written to the Event Log.
 1831    ''' </param>
 1832    ''' <remarks>
 1833    ''' <para>
 1834    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1835    ''' </para>
 1836    ''' <para>
 1837    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1838    ''' </para>
 1839    ''' </remarks>
 1081840    Public Sub Log(
 1081841            ByVal logName As String,
 1081842            ByVal sourceName As String,
 1081843            ByVal message As String,
 1081844            ByVal eventType As EventLogEntryType,
 1081845            ByVal eventID As Integer,
 1081846            ByVal category As Short,
 1081847            ByVal EntrySeverity As LoggingSeverity)
 1848
 2161849        Log("",
 2161850            logName,
 2161851            sourceName,
 2161852            message,
 2161853            eventType,
 2161854            eventID,
 2161855            category,
 2161856            Nothing,
 2161857            EntrySeverity)
 1858
 2161859    End Sub
 1860
 1861    ''' <summary>
 1862    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1863    ''' </summary>
 1864    ''' <param name="message">
 1865    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1866    '''
 1867    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1868    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1869    '''
 1870    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1871    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1872    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1873    ''' </param>
 1874    ''' <param name="rawData">
 1875    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1876    ''' </param>
 1877    ''' <remarks>
 1878    ''' <para>
 1879    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1880    ''' </para>
 1881    ''' <para>
 1882    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1883    ''' </para>
 1884    ''' </remarks>
 61885    Public Sub Log(
 61886            ByVal message As String,
 61887            ByVal rawData As Byte())
 1888
 121889        Log(message,
 121890            EventLogEntryType.Information,
 121891            rawData)
 1892
 121893    End Sub
 1894
 1895    ''' <summary>
 1896    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1897    ''' </summary>
 1898    ''' <param name="message">
 1899    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1900    '''
 1901    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1902    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1903    '''
 1904    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1905    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1906    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1907    ''' </param>
 1908    ''' <param name="rawData">
 1909    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1910    ''' </param>
 1911    ''' <param name="EntrySeverity">
 1912    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1913    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1914    ''' will be skipped and not written to the Event Log.
 1915    ''' </param>
 1916    ''' <remarks>
 1917    ''' <para>
 1918    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1919    ''' </para>
 1920    ''' <para>
 1921    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1922    ''' </para>
 1923    ''' </remarks>
 61924    Public Sub Log(
 61925            ByVal message As String,
 61926            ByVal rawData As Byte(),
 61927            ByVal EntrySeverity As LoggingSeverity)
 1928
 121929        Log(message,
 121930            EventLogEntryType.Information,
 121931            rawData,
 121932            EntrySeverity)
 1933
 121934    End Sub
 1935
 1936    ''' <summary>
 1937    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1938    ''' </summary>
 1939    ''' <param name="message">
 1940    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1941    '''
 1942    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1943    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1944    '''
 1945    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1946    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1947    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1948    ''' </param>
 1949    ''' <param name="eventType">
 1950    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1951    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1952    ''' </param>
 1953    ''' <param name="rawData">
 1954    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1955    ''' </param>
 1956    ''' <remarks>
 1957    ''' <para>
 1958    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1959    ''' </para>
 1960    ''' <para>
 1961    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1962    ''' </para>
 1963    ''' </remarks>
 121964    Public Sub Log(
 121965            ByVal message As String,
 121966            ByVal eventType As EventLogEntryType,
 121967            ByVal rawData As Byte())
 1968
 241969        Log(message,
 241970            eventType,
 241971            0,
 241972            rawData)
 1973
 241974    End Sub
 1975
 1976    ''' <summary>
 1977    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1978    ''' </summary>
 1979    ''' <param name="message">
 1980    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1981    '''
 1982    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1983    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1984    '''
 1985    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1986    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1987    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1988    ''' </param>
 1989    ''' <param name="eventType">
 1990    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1991    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1992    ''' </param>
 1993    ''' <param name="rawData">
 1994    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1995    ''' </param>
 1996    ''' <param name="EntrySeverity">
 1997    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 1998    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 1999    ''' will be skipped and not written to the Event Log.
 2000    ''' </param>
 2001    ''' <remarks>
 2002    ''' <para>
 2003    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2004    ''' </para>
 2005    ''' <para>
 2006    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2007    ''' </para>
 2008    ''' </remarks>
 62009    Public Sub Log(
 62010            ByVal message As String,
 62011            ByVal eventType As EventLogEntryType,
 62012            ByVal rawData As Byte(),
 62013            ByVal EntrySeverity As LoggingSeverity)
 2014
 122015        Log(message,
 122016            eventType,
 122017            0,
 122018            rawData,
 122019            EntrySeverity)
 2020
 122021    End Sub
 2022
 2023    ''' <summary>
 2024    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2025    ''' </summary>
 2026    ''' <param name="message">
 2027    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2028    '''
 2029    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2030    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2031    '''
 2032    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2033    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2034    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2035    ''' </param>
 2036    ''' <param name="eventType">
 2037    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2038    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2039    ''' </param>
 2040    ''' <param name="eventID">
 2041    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2042    ''' </param>
 2043    ''' <param name="rawData">
 2044    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2045    ''' </param>
 2046    ''' <remarks>
 2047    ''' <para>
 2048    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2049    ''' </para>
 2050    ''' <para>
 2051    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2052    ''' </para>
 2053    ''' </remarks>
 182054    Public Sub Log(
 182055            ByVal message As String,
 182056            ByVal eventType As EventLogEntryType,
 182057            ByVal eventID As Integer,
 182058            ByVal rawData As Byte())
 2059
 362060        Log(message,
 362061            eventType,
 362062            eventID,
 362063            0,
 362064            rawData)
 2065
 362066    End Sub
 2067
 2068    ''' <summary>
 2069    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2070    ''' </summary>
 2071    ''' <param name="message">
 2072    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2073    '''
 2074    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2075    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2076    '''
 2077    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2078    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2079    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2080    ''' </param>
 2081    ''' <param name="eventType">
 2082    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2083    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2084    ''' </param>
 2085    ''' <param name="eventID">
 2086    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2087    ''' </param>
 2088    ''' <param name="rawData">
 2089    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2090    ''' </param>
 2091    ''' <param name="EntrySeverity">
 2092    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 2093    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 2094    ''' will be skipped and not written to the Event Log.
 2095    ''' </param>
 2096    ''' <remarks>
 2097    ''' <para>
 2098    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2099    ''' </para>
 2100    ''' <para>
 2101    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2102    ''' </para>
 2103    ''' </remarks>
 62104    Public Sub Log(
 62105            ByVal message As String,
 62106            ByVal eventType As EventLogEntryType,
 62107            ByVal eventID As Integer,
 62108            ByVal rawData As Byte(),
 62109            ByVal EntrySeverity As LoggingSeverity)
 2110
 122111        Log(message,
 122112            eventType,
 122113            eventID,
 122114            0,
 122115            rawData,
 122116            EntrySeverity)
 2117
 122118    End Sub
 2119
 2120    ''' <summary>
 2121    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2122    ''' </summary>
 2123    ''' <param name="message">
 2124    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2125    '''
 2126    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2127    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2128    '''
 2129    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2130    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2131    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2132    ''' </param>
 2133    ''' <param name="eventType">
 2134    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2135    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2136    ''' </param>
 2137    ''' <param name="eventID">
 2138    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2139    ''' </param>
 2140    ''' <param name="category">
 2141    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2142    ''' </param>
 2143    ''' <param name="rawData">
 2144    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2145    ''' </param>
 2146    ''' <remarks>
 2147    ''' <para>
 2148    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2149    ''' </para>
 2150    ''' <para>
 2151    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2152    ''' </para>
 2153    ''' </remarks>
 242154    Public Sub Log(
 242155            ByVal message As String,
 242156            ByVal eventType As EventLogEntryType,
 242157            ByVal eventID As Integer,
 242158            ByVal category As Short,
 242159            ByVal rawData As Byte())
 2160
 482161        Log("",
 482162            "",
 482163            "",
 482164            message,
 482165            eventType,
 482166            eventID,
 482167            category,
 482168            rawData)
 2169
 482170    End Sub
 2171
 2172    ''' <summary>
 2173    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2174    ''' </summary>
 2175    ''' <param name="message">
 2176    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2177    '''
 2178    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2179    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2180    '''
 2181    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2182    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2183    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2184    ''' </param>
 2185    ''' <param name="eventType">
 2186    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2187    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2188    ''' </param>
 2189    ''' <param name="eventID">
 2190    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2191    ''' </param>
 2192    ''' <param name="category">
 2193    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2194    ''' </param>
 2195    ''' <param name="rawData">
 2196    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2197    ''' </param>
 2198    ''' <param name="EntrySeverity">
 2199    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 2200    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 2201    ''' will be skipped and not written to the Event Log.
 2202    ''' </param>
 2203    ''' <remarks>
 2204    ''' <para>
 2205    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2206    ''' </para>
 2207    ''' <para>
 2208    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2209    ''' </para>
 2210    ''' </remarks>
 62211    Public Sub Log(
 62212            ByVal message As String,
 62213            ByVal eventType As EventLogEntryType,
 62214            ByVal eventID As Integer,
 62215            ByVal category As Short,
 62216            ByVal rawData As Byte(),
 62217            ByVal EntrySeverity As LoggingSeverity)
 2218
 122219        Log("",
 122220            "",
 122221            "",
 122222            message,
 122223            eventType,
 122224            eventID,
 122225            category,
 122226            rawData,
 122227            EntrySeverity)
 2228
 122229    End Sub
 2230
 2231    ''' <summary>
 2232    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2233    ''' </summary>
 2234    ''' <param name="sourceName">
 2235    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2236    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2237    ''' </param>
 2238    ''' <param name="message">
 2239    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2240    '''
 2241    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2242    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2243    '''
 2244    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2245    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2246    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2247    ''' </param>
 2248    ''' <param name="eventType">
 2249    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2250    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2251    ''' </param>
 2252    ''' <param name="eventID">
 2253    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2254    ''' </param>
 2255    ''' <param name="category">
 2256    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2257    ''' </param>
 2258    ''' <param name="rawData">
 2259    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2260    ''' </param>
 2261    ''' <remarks>
 2262    ''' <para>
 2263    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2264    ''' </para>
 2265    ''' <para>
 2266    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2267    ''' </para>
 2268    ''' </remarks>
 62269    Public Sub Log(
 62270            ByVal sourceName As String,
 62271            ByVal message As String,
 62272            ByVal eventType As EventLogEntryType,
 62273            ByVal eventID As Integer,
 62274            ByVal category As Short,
 62275            ByVal rawData As Byte())
 2276
 122277        Log("",
 122278            "",
 122279            sourceName,
 122280            message,
 122281            eventType,
 122282            eventID,
 122283            category,
 122284            rawData)
 2285
 122286    End Sub
 2287
 2288    ''' <summary>
 2289    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2290    ''' </summary>
 2291    ''' <param name="sourceName">
 2292    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2293    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2294    ''' </param>
 2295    ''' <param name="message">
 2296    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2297    '''
 2298    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2299    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2300    '''
 2301    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2302    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2303    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2304    ''' </param>
 2305    ''' <param name="eventType">
 2306    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2307    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2308    ''' </param>
 2309    ''' <param name="eventID">
 2310    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2311    ''' </param>
 2312    ''' <param name="category">
 2313    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2314    ''' </param>
 2315    ''' <param name="rawData">
 2316    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2317    ''' </param>
 2318    ''' <param name="EntrySeverity">
 2319    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 2320    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 2321    ''' will be skipped and not written to the Event Log.
 2322    ''' </param>
 2323    ''' <remarks>
 2324    ''' <para>
 2325    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2326    ''' </para>
 2327    ''' <para>
 2328    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2329    ''' </para>
 2330    ''' </remarks>
 62331    Public Sub Log(
 62332            ByVal sourceName As String,
 62333            ByVal message As String,
 62334            ByVal eventType As EventLogEntryType,
 62335            ByVal eventID As Integer,
 62336            ByVal category As Short,
 62337            ByVal rawData As Byte(),
 62338            ByVal EntrySeverity As LoggingSeverity)
 2339
 122340        Log("",
 122341            "",
 122342            sourceName,
 122343            message,
 122344            eventType,
 122345            eventID,
 122346            category,
 122347            rawData,
 122348            EntrySeverity)
 2349
 122350    End Sub
 2351
 2352    ''' <summary>
 2353    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2354    ''' </summary>
 2355    ''' <param name="logName">
 2356    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 2357    ''' If <c>null</c> or empty, "Application" is used by default.
 2358    ''' </param>
 2359    ''' <param name="source">
 2360    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2361    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2362    ''' </param>
 2363    ''' <param name="message">
 2364    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2365    '''
 2366    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2367    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2368    '''
 2369    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2370    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2371    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2372    ''' </param>
 2373    ''' <param name="eventType">
 2374    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2375    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2376    ''' </param>
 2377    ''' <param name="eventID">
 2378    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2379    ''' </param>
 2380    ''' <param name="category">
 2381    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2382    ''' </param>
 2383    ''' <param name="rawData">
 2384    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2385    ''' </param>
 2386    ''' <remarks>
 2387    ''' <para>
 2388    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2389    ''' </para>
 2390    ''' <para>
 2391    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2392    ''' </para>
 2393    ''' </remarks>
 602394    Public Sub Log(
 602395            ByVal logName As String,
 602396            ByVal source As String,
 602397            ByVal message As String,
 602398            ByVal eventType As EventLogEntryType,
 602399            ByVal eventID As Integer,
 602400            ByVal category As Short,
 602401            ByVal rawData As Byte())
 2402
 1202403        Log(
 1202404            "",
 1202405            logName,
 1202406            source,
 1202407            message,
 1202408            eventType,
 1202409            eventID,
 1202410            category,
 1202411            rawData)
 2412
 1202413    End Sub
 2414
 2415    ''' <summary>
 2416    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2417    ''' </summary>
 2418    ''' <param name="logName">
 2419    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 2420    ''' If <c>null</c> or empty, "Application" is used by default.
 2421    ''' </param>
 2422    ''' <param name="source">
 2423    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2424    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2425    ''' </param>
 2426    ''' <param name="message">
 2427    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2428    '''
 2429    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2430    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2431    '''
 2432    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2433    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2434    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2435    ''' </param>
 2436    ''' <param name="eventType">
 2437    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2438    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2439    ''' </param>
 2440    ''' <param name="eventID">
 2441    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2442    ''' </param>
 2443    ''' <param name="category">
 2444    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2445    ''' </param>
 2446    ''' <param name="rawData">
 2447    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2448    ''' </param>
 2449    ''' <param name="EntrySeverity">
 2450    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 2451    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 2452    ''' will be skipped and not written to the Event Log.
 2453    ''' </param>
 2454    ''' <remarks>
 2455    ''' <para>
 2456    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2457    ''' </para>
 2458    ''' <para>
 2459    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2460    ''' </para>
 2461    ''' </remarks>
 62462    Public Sub Log(
 62463            ByVal logName As String,
 62464            ByVal source As String,
 62465            ByVal message As String,
 62466            ByVal eventType As EventLogEntryType,
 62467            ByVal eventID As Integer,
 62468            ByVal category As Short,
 62469            ByVal rawData As Byte(),
 62470            ByVal EntrySeverity As LoggingSeverity)
 2471
 122472        Log(
 122473            "",
 122474            logName,
 122475            source,
 122476            message,
 122477            eventType,
 122478            eventID,
 122479            category,
 122480            rawData,
 122481            EntrySeverity)
 2482
 122483    End Sub
 2484
 2485    ''' <summary>
 2486    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2487    ''' </summary>
 2488    ''' <param name="logName">
 2489    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 2490    ''' If <c>null</c> or empty, "Application" is used by default.
 2491    ''' </param>
 2492    ''' <param name="source">
 2493    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2494    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2495    ''' </param>
 2496    ''' <param name="message">
 2497    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2498    '''
 2499    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2500    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2501    '''
 2502    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2503    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2504    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2505    ''' </param>
 2506    ''' <param name="eventType">
 2507    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2508    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2509    ''' </param>
 2510    ''' <param name="eventID">
 2511    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2512    ''' </param>
 2513    ''' <param name="category">
 2514    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2515    ''' </param>
 2516    ''' <param name="rawData">
 2517    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2518    ''' </param>
 2519    ''' <remarks>
 2520    ''' <para>
 2521    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2522    ''' </para>
 2523    ''' <para>
 2524    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2525    ''' </para>
 2526    ''' </remarks>
 1082527    Public Sub Log(
 1082528            ByVal machineName As String,
 1082529            ByVal logName As String,
 1082530            ByVal source As String,
 1082531            ByVal message As String,
 1082532            ByVal eventType As EventLogEntryType,
 1082533            ByVal eventID As Integer,
 1082534            ByVal category As Short,
 1082535            ByVal rawData As Byte())
 2536
 2162537        Initialize()
 2162538        Log(
 2162539            machineName,
 2162540            logName,
 2162541            source,
 2162542            message,
 2162543            eventType,
 2162544            eventID,
 2162545            category,
 2162546            rawData,
 2162547            MaxKilobytes)
 2548
 2162549    End Sub
 2550
 2551    ''' <summary>
 2552    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2553    ''' </summary>
 2554    ''' <param name="logName">
 2555    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 2556    ''' If <c>null</c> or empty, "Application" is used by default.
 2557    ''' </param>
 2558    ''' <param name="source">
 2559    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2560    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2561    ''' </param>
 2562    ''' <param name="message">
 2563    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2564    '''
 2565    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2566    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2567    '''
 2568    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2569    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2570    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2571    ''' </param>
 2572    ''' <param name="eventType">
 2573    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2574    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2575    ''' </param>
 2576    ''' <param name="eventID">
 2577    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2578    ''' </param>
 2579    ''' <param name="category">
 2580    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2581    ''' </param>
 2582    ''' <param name="rawData">
 2583    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2584    ''' </param>
 2585    ''' <param name="EntrySeverity">
 2586    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 2587    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 2588    ''' will be skipped and not written to the Event Log.
 2589    ''' </param>
 2590    ''' <remarks>
 2591    ''' <para>
 2592    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2593    ''' </para>
 2594    ''' <para>
 2595    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2596    ''' </para>
 2597    ''' </remarks>
 1262598    Public Sub Log(
 1262599            ByVal machineName As String,
 1262600            ByVal logName As String,
 1262601            ByVal source As String,
 1262602            ByVal message As String,
 1262603            ByVal eventType As EventLogEntryType,
 1262604            ByVal eventID As Integer,
 1262605            ByVal category As Short,
 1262606            ByVal rawData As Byte(),
 1262607            ByVal EntrySeverity As LoggingSeverity)
 2608
 2522609        Initialize()
 2522610        Log(
 2522611            machineName,
 2522612            logName,
 2522613            source,
 2522614            message,
 2522615            eventType,
 2522616            eventID,
 2522617            category,
 2522618            rawData,
 2522619            MaxKilobytes,
 2522620            EntrySeverity)
 2621
 2522622    End Sub
 2623
 2624    ''' <summary>
 2625    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2626    ''' </summary>
 2627    ''' <param name="logName">
 2628    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 2629    ''' If <c>null</c> or empty, "Application" is used by default.
 2630    ''' </param>
 2631    ''' <param name="source">
 2632    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2633    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2634    ''' </param>
 2635    ''' <param name="message">
 2636    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2637    '''
 2638    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2639    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2640    '''
 2641    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2642    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2643    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2644    ''' </param>
 2645    ''' <param name="eventType">
 2646    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2647    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2648    ''' </param>
 2649    ''' <param name="eventID">
 2650    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2651    ''' </param>
 2652    ''' <param name="category">
 2653    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2654    ''' </param>
 2655    ''' <param name="rawData">
 2656    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2657    ''' </param>
 2658    ''' <param name="maxKilobytes">
 2659    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2660    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2661    ''' </param>
 2662    ''' <remarks>
 2663    ''' <para>
 2664    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2665    ''' </para>
 2666    ''' <para>
 2667    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2668    ''' </para>
 2669    ''' </remarks>
 1082670    Public Sub Log(
 1082671            ByVal machineName As String,
 1082672            ByVal logName As String,
 1082673            ByVal source As String,
 1082674            ByVal message As String,
 1082675            ByVal eventType As EventLogEntryType,
 1082676            ByVal eventID As Integer,
 1082677            ByVal category As Short,
 1082678            ByVal rawData As Byte(),
 1082679            ByVal maxKilobytes As Integer)
 2680
 2162681        Initialize()
 2162682        Log(
 2162683            machineName,
 2162684            logName,
 2162685            source,
 2162686            message,
 2162687            eventType,
 2162688            eventID,
 2162689            category,
 2162690            rawData,
 2162691            maxKilobytes,
 2162692            RetentionDays)
 2693
 2162694    End Sub
 2695
 2696    ''' <summary>
 2697    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2698    ''' </summary>
 2699    ''' <param name="logName">
 2700    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 2701    ''' If <c>null</c> or empty, "Application" is used by default.
 2702    ''' </param>
 2703    ''' <param name="source">
 2704    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2705    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2706    ''' </param>
 2707    ''' <param name="message">
 2708    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2709    '''
 2710    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2711    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2712    '''
 2713    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2714    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2715    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2716    ''' </param>
 2717    ''' <param name="eventType">
 2718    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2719    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2720    ''' </param>
 2721    ''' <param name="eventID">
 2722    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2723    ''' </param>
 2724    ''' <param name="category">
 2725    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2726    ''' </param>
 2727    ''' <param name="rawData">
 2728    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2729    ''' </param>
 2730    ''' <param name="maxKilobytes">
 2731    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2732    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2733    ''' </param>
 2734    ''' <param name="EntrySeverity">
 2735    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 2736    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 2737    ''' will be skipped and not written to the Event Log.
 2738    ''' </param>
 2739    ''' <remarks>
 2740    ''' <para>
 2741    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2742    ''' </para>
 2743    ''' <para>
 2744    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2745    ''' </para>
 2746    ''' </remarks>
 1262747    Public Sub Log(
 1262748            ByVal machineName As String,
 1262749            ByVal logName As String,
 1262750            ByVal source As String,
 1262751            ByVal message As String,
 1262752            ByVal eventType As EventLogEntryType,
 1262753            ByVal eventID As Integer,
 1262754            ByVal category As Short,
 1262755            ByVal rawData As Byte(),
 1262756            ByVal maxKilobytes As Integer,
 1262757            ByVal EntrySeverity As LoggingSeverity)
 2758
 2522759        Initialize()
 2522760        Log(
 2522761            machineName,
 2522762            logName,
 2522763            source,
 2522764            message,
 2522765            eventType,
 2522766            eventID,
 2522767            category,
 2522768            rawData,
 2522769            maxKilobytes,
 2522770            RetentionDays,
 2522771            EntrySeverity)
 2772
 2522773    End Sub
 2774
 2775    ''' <summary>
 2776    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2777    ''' </summary>
 2778    ''' <param name="message">
 2779    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2780    '''
 2781    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2782    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2783    '''
 2784    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2785    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2786    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2787    ''' </param>
 2788    ''' <param name="maxKilobytes">
 2789    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2790    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2791    ''' </param>
 2792    ''' <param name="retentionDays">
 2793    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2794    ''' Only used when creating a new log.
 2795    ''' </param>
 2796    ''' <remarks>
 2797    ''' <para>
 2798    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2799    ''' </para>
 2800    ''' <para>
 2801    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2802    ''' </para>
 2803    ''' </remarks>
 62804    Public Sub Log(
 62805            ByVal message As String,
 62806            ByVal maxKilobytes As Integer,
 62807            ByVal retentionDays As Integer)
 2808
 122809        Log(
 122810            message,
 122811            EventLogEntryType.Information,
 122812            maxKilobytes,
 122813            retentionDays)
 2814
 122815    End Sub
 2816
 2817    ''' <summary>
 2818    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2819    ''' </summary>
 2820    ''' <param name="message">
 2821    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2822    '''
 2823    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2824    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2825    '''
 2826    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2827    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2828    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2829    ''' </param>
 2830    ''' <param name="maxKilobytes">
 2831    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2832    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2833    ''' </param>
 2834    ''' <param name="retentionDays">
 2835    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2836    ''' Only used when creating a new log.
 2837    ''' </param>
 2838    ''' <param name="EntrySeverity">
 2839    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 2840    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 2841    ''' will be skipped and not written to the Event Log.
 2842    ''' </param>
 2843    ''' <remarks>
 2844    ''' <para>
 2845    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2846    ''' </para>
 2847    ''' <para>
 2848    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2849    ''' </para>
 2850    ''' </remarks>
 62851    Public Sub Log(
 62852            ByVal message As String,
 62853            ByVal maxKilobytes As Integer,
 62854            ByVal retentionDays As Integer,
 62855            ByVal EntrySeverity As LoggingSeverity)
 2856
 122857        Log(
 122858            message,
 122859            EventLogEntryType.Information,
 122860            maxKilobytes,
 122861            retentionDays,
 122862            EntrySeverity)
 2863
 122864    End Sub
 2865
 2866    ''' <summary>
 2867    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2868    ''' </summary>
 2869    ''' <param name="message">
 2870    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2871    '''
 2872    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2873    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2874    '''
 2875    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2876    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2877    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2878    ''' </param>
 2879    ''' <param name="eventType">
 2880    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2881    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2882    ''' </param>
 2883    ''' <param name="maxKilobytes">
 2884    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2885    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2886    ''' </param>
 2887    ''' <param name="retentionDays">
 2888    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2889    ''' Only used when creating a new log.
 2890    ''' </param>
 2891    ''' <remarks>
 2892    ''' <para>
 2893    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2894    ''' </para>
 2895    ''' <para>
 2896    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2897    ''' </para>
 2898    ''' </remarks>
 62899    Public Sub Log(
 62900            ByVal message As String,
 62901            ByVal eventType As EventLogEntryType,
 62902            ByVal maxKilobytes As Integer,
 62903            ByVal retentionDays As Integer)
 2904
 122905        Log(
 122906            message,
 122907            eventType,
 122908            0,
 122909            maxKilobytes,
 122910            retentionDays)
 2911
 122912    End Sub
 2913
 2914    ''' <summary>
 2915    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2916    ''' </summary>
 2917    ''' <param name="message">
 2918    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2919    '''
 2920    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2921    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2922    '''
 2923    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2924    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2925    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2926    ''' </param>
 2927    ''' <param name="eventType">
 2928    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2929    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2930    ''' </param>
 2931    ''' <param name="maxKilobytes">
 2932    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2933    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2934    ''' </param>
 2935    ''' <param name="retentionDays">
 2936    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2937    ''' Only used when creating a new log.
 2938    ''' </param>
 2939    ''' <param name="EntrySeverity">
 2940    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 2941    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 2942    ''' will be skipped and not written to the Event Log.
 2943    ''' </param>
 2944    ''' <remarks>
 2945    ''' <para>
 2946    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2947    ''' </para>
 2948    ''' <para>
 2949    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2950    ''' </para>
 2951    ''' </remarks>
 62952    Public Sub Log(
 62953            ByVal message As String,
 62954            ByVal eventType As EventLogEntryType,
 62955            ByVal maxKilobytes As Integer,
 62956            ByVal retentionDays As Integer,
 62957            ByVal EntrySeverity As LoggingSeverity)
 2958
 122959        Log(
 122960            message,
 122961            eventType,
 122962            0,
 122963            maxKilobytes,
 122964            retentionDays,
 122965            EntrySeverity)
 2966
 122967    End Sub
 2968
 2969    ''' <summary>
 2970    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2971    ''' </summary>
 2972    ''' <param name="message">
 2973    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2974    '''
 2975    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2976    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2977    '''
 2978    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2979    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2980    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2981    ''' </param>
 2982    ''' <param name="eventType">
 2983    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2984    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2985    ''' </param>
 2986    ''' <param name="eventID">
 2987    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2988    ''' </param>
 2989    ''' <param name="maxKilobytes">
 2990    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2991    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2992    ''' </param>
 2993    ''' <param name="retentionDays">
 2994    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2995    ''' Only used when creating a new log.
 2996    ''' </param>
 2997    ''' <remarks>
 2998    ''' <para>
 2999    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3000    ''' </para>
 3001    ''' <para>
 3002    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3003    ''' </para>
 3004    ''' </remarks>
 63005    Public Sub Log(
 63006            ByVal message As String,
 63007            ByVal eventType As EventLogEntryType,
 63008            ByVal eventID As Integer,
 63009            ByVal maxKilobytes As Integer,
 63010            ByVal retentionDays As Integer)
 3011
 123012        Log(
 123013            message,
 123014            eventType,
 123015            eventID,
 123016            0,
 123017            maxKilobytes,
 123018            retentionDays)
 3019
 123020    End Sub
 3021
 3022    ''' <summary>
 3023    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3024    ''' </summary>
 3025    ''' <param name="message">
 3026    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3027    '''
 3028    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3029    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3030    '''
 3031    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3032    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3033    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3034    ''' </param>
 3035    ''' <param name="eventType">
 3036    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3037    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3038    ''' </param>
 3039    ''' <param name="eventID">
 3040    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3041    ''' </param>
 3042    ''' <param name="maxKilobytes">
 3043    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3044    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3045    ''' </param>
 3046    ''' <param name="retentionDays">
 3047    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3048    ''' Only used when creating a new log.
 3049    ''' </param>
 3050    ''' <param name="EntrySeverity">
 3051    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 3052    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 3053    ''' will be skipped and not written to the Event Log.
 3054    ''' </param>
 3055    ''' <remarks>
 3056    ''' <para>
 3057    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3058    ''' </para>
 3059    ''' <para>
 3060    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3061    ''' </para>
 3062    ''' </remarks>
 63063    Public Sub Log(
 63064            ByVal message As String,
 63065            ByVal eventType As EventLogEntryType,
 63066            ByVal eventID As Integer,
 63067            ByVal maxKilobytes As Integer,
 63068            ByVal retentionDays As Integer,
 63069            ByVal EntrySeverity As LoggingSeverity)
 3070
 123071        Log(
 123072            message,
 123073            eventType,
 123074            eventID,
 123075            0,
 123076            maxKilobytes,
 123077            retentionDays,
 123078            EntrySeverity)
 3079
 123080    End Sub
 3081
 3082    ''' <summary>
 3083    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3084    ''' </summary>
 3085    ''' <param name="message">
 3086    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3087    '''
 3088    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3089    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3090    '''
 3091    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3092    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3093    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3094    ''' </param>
 3095    ''' <param name="eventType">
 3096    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3097    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3098    ''' </param>
 3099    ''' <param name="eventID">
 3100    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3101    ''' </param>
 3102    ''' <param name="category">
 3103    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3104    ''' </param>
 3105    ''' <param name="maxKilobytes">
 3106    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3107    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3108    ''' </param>
 3109    ''' <param name="retentionDays">
 3110    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3111    ''' Only used when creating a new log.
 3112    ''' </param>
 3113    ''' <remarks>
 3114    ''' <para>
 3115    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3116    ''' </para>
 3117    ''' <para>
 3118    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3119    ''' </para>
 3120    ''' </remarks>
 63121    Public Sub Log(
 63122            ByVal message As String,
 63123            ByVal eventType As EventLogEntryType,
 63124            ByVal eventID As Integer,
 63125            ByVal category As Short,
 63126            ByVal maxKilobytes As Integer,
 63127            ByVal retentionDays As Integer)
 3128
 123129        Log(
 123130            message,
 123131            eventType,
 123132            eventID,
 123133            category,
 123134            Nothing,
 123135            maxKilobytes,
 123136            retentionDays)
 3137
 123138    End Sub
 3139
 3140    ''' <summary>
 3141    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3142    ''' </summary>
 3143    ''' <param name="message">
 3144    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3145    '''
 3146    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3147    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3148    '''
 3149    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3150    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3151    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3152    ''' </param>
 3153    ''' <param name="eventType">
 3154    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3155    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3156    ''' </param>
 3157    ''' <param name="eventID">
 3158    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3159    ''' </param>
 3160    ''' <param name="category">
 3161    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3162    ''' </param>
 3163    ''' <param name="maxKilobytes">
 3164    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3165    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3166    ''' </param>
 3167    ''' <param name="retentionDays">
 3168    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3169    ''' Only used when creating a new log.
 3170    ''' </param>
 3171    ''' <param name="EntrySeverity">
 3172    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 3173    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 3174    ''' will be skipped and not written to the Event Log.
 3175    ''' </param>
 3176    ''' <remarks>
 3177    ''' <para>
 3178    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3179    ''' </para>
 3180    ''' <para>
 3181    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3182    ''' </para>
 3183    ''' </remarks>
 63184    Public Sub Log(
 63185            ByVal message As String,
 63186            ByVal eventType As EventLogEntryType,
 63187            ByVal eventID As Integer,
 63188            ByVal category As Short,
 63189            ByVal maxKilobytes As Integer,
 63190            ByVal retentionDays As Integer,
 63191            ByVal EntrySeverity As LoggingSeverity)
 3192
 123193        Log(
 123194            message,
 123195            eventType,
 123196            eventID,
 123197            category,
 123198            Nothing,
 123199            maxKilobytes,
 123200            retentionDays,
 123201            EntrySeverity)
 3202
 123203    End Sub
 3204
 3205    ''' <summary>
 3206    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3207    ''' </summary>
 3208    ''' <param name="message">
 3209    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3210    '''
 3211    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3212    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3213    '''
 3214    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3215    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3216    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3217    ''' </param>
 3218    ''' <param name="eventType">
 3219    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3220    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3221    ''' </param>
 3222    ''' <param name="eventID">
 3223    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3224    ''' </param>
 3225    ''' <param name="category">
 3226    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3227    ''' </param>
 3228    ''' <param name="rawData">
 3229    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 3230    ''' </param>
 3231    ''' <param name="maxKilobytes">
 3232    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3233    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3234    ''' </param>
 3235    ''' <param name="retentionDays">
 3236    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3237    ''' Only used when creating a new log.
 3238    ''' </param>
 3239    ''' <remarks>
 3240    ''' <para>
 3241    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3242    ''' </para>
 3243    ''' <para>
 3244    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3245    ''' </para>
 3246    ''' </remarks>
 63247    Public Sub Log(
 63248            ByVal message As String,
 63249            ByVal eventType As EventLogEntryType,
 63250            ByVal eventID As Integer,
 63251            ByVal category As Short,
 63252            ByVal rawData As Byte(),
 63253            ByVal maxKilobytes As Integer,
 63254            ByVal retentionDays As Integer)
 3255
 123256        Log(
 123257            "",
 123258            message,
 123259            eventType,
 123260            eventID,
 123261            category,
 123262            rawData,
 123263            maxKilobytes,
 123264            retentionDays)
 3265
 123266    End Sub
 3267
 3268    ''' <summary>
 3269    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3270    ''' </summary>
 3271    ''' <param name="message">
 3272    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3273    '''
 3274    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3275    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3276    '''
 3277    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3278    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3279    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3280    ''' </param>
 3281    ''' <param name="eventType">
 3282    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3283    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3284    ''' </param>
 3285    ''' <param name="eventID">
 3286    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3287    ''' </param>
 3288    ''' <param name="category">
 3289    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3290    ''' </param>
 3291    ''' <param name="rawData">
 3292    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 3293    ''' </param>
 3294    ''' <param name="maxKilobytes">
 3295    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3296    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3297    ''' </param>
 3298    ''' <param name="retentionDays">
 3299    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3300    ''' Only used when creating a new log.
 3301    ''' </param>
 3302    ''' <param name="EntrySeverity">
 3303    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 3304    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 3305    ''' will be skipped and not written to the Event Log.
 3306    ''' </param>
 3307    ''' <remarks>
 3308    ''' <para>
 3309    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3310    ''' </para>
 3311    ''' <para>
 3312    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3313    ''' </para>
 3314    ''' </remarks>
 63315    Public Sub Log(
 63316            ByVal message As String,
 63317            ByVal eventType As EventLogEntryType,
 63318            ByVal eventID As Integer,
 63319            ByVal category As Short,
 63320            ByVal rawData As Byte(),
 63321            ByVal maxKilobytes As Integer,
 63322            ByVal retentionDays As Integer,
 63323            ByVal EntrySeverity As LoggingSeverity)
 3324
 123325        Log(
 123326            "",
 123327            message,
 123328            eventType,
 123329            eventID,
 123330            category,
 123331            rawData,
 123332            maxKilobytes,
 123333            retentionDays,
 123334            EntrySeverity)
 3335
 123336    End Sub
 3337
 3338    ''' <summary>
 3339    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3340    ''' </summary>
 3341    ''' <param name="source">
 3342    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 3343    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 3344    ''' </param>
 3345    ''' <param name="message">
 3346    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3347    '''
 3348    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3349    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3350    '''
 3351    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3352    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3353    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3354    ''' </param>
 3355    ''' <param name="eventType">
 3356    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3357    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3358    ''' </param>
 3359    ''' <param name="eventID">
 3360    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3361    ''' </param>
 3362    ''' <param name="category">
 3363    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3364    ''' </param>
 3365    ''' <param name="rawData">
 3366    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 3367    ''' </param>
 3368    ''' <param name="maxKilobytes">
 3369    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3370    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3371    ''' </param>
 3372    ''' <param name="retentionDays">
 3373    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3374    ''' Only used when creating a new log.
 3375    ''' </param>
 3376    ''' <remarks>
 3377    ''' <para>
 3378    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3379    ''' </para>
 3380    ''' <para>
 3381    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3382    ''' </para>
 3383    ''' </remarks>
 63384    Public Sub Log(
 63385            ByVal source As String,
 63386            ByVal message As String,
 63387            ByVal eventType As EventLogEntryType,
 63388            ByVal eventID As Integer,
 63389            ByVal category As Short,
 63390            ByVal rawData As Byte(),
 63391            ByVal maxKilobytes As Integer,
 63392            ByVal retentionDays As Integer)
 3393
 123394        Log(
 123395            "",
 123396            source,
 123397            message,
 123398            eventType,
 123399            eventID,
 123400            category,
 123401            rawData,
 123402            maxKilobytes,
 123403            retentionDays)
 3404
 123405    End Sub
 3406
 3407    ''' <summary>
 3408    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3409    ''' </summary>
 3410    ''' <param name="source">
 3411    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 3412    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 3413    ''' </param>
 3414    ''' <param name="message">
 3415    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3416    '''
 3417    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3418    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3419    '''
 3420    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3421    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3422    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3423    ''' </param>
 3424    ''' <param name="eventType">
 3425    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3426    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3427    ''' </param>
 3428    ''' <param name="eventID">
 3429    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3430    ''' </param>
 3431    ''' <param name="category">
 3432    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3433    ''' </param>
 3434    ''' <param name="rawData">
 3435    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 3436    ''' </param>
 3437    ''' <param name="maxKilobytes">
 3438    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3439    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3440    ''' </param>
 3441    ''' <param name="retentionDays">
 3442    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3443    ''' Only used when creating a new log.
 3444    ''' </param>
 3445    ''' <param name="EntrySeverity">
 3446    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 3447    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 3448    ''' will be skipped and not written to the Event Log.
 3449    ''' </param>
 3450    ''' <remarks>
 3451    ''' <para>
 3452    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3453    ''' </para>
 3454    ''' <para>
 3455    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3456    ''' </para>
 3457    ''' </remarks>
 63458    Public Sub Log(
 63459            ByVal source As String,
 63460            ByVal message As String,
 63461            ByVal eventType As EventLogEntryType,
 63462            ByVal eventID As Integer,
 63463            ByVal category As Short,
 63464            ByVal rawData As Byte(),
 63465            ByVal maxKilobytes As Integer,
 63466            ByVal retentionDays As Integer,
 63467            ByVal EntrySeverity As LoggingSeverity)
 3468
 123469        Log(
 123470            "",
 123471            source,
 123472            message,
 123473            eventType,
 123474            eventID,
 123475            category,
 123476            rawData,
 123477            maxKilobytes,
 123478            retentionDays,
 123479            EntrySeverity)
 3480
 123481    End Sub
 3482
 3483    ''' <summary>
 3484    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3485    ''' </summary>
 3486    ''' <param name="logName">
 3487    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 3488    ''' If <c>null</c> or empty, "Application" is used by default.
 3489    ''' </param>
 3490    ''' <param name="source">
 3491    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 3492    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 3493    ''' </param>
 3494    ''' <param name="message">
 3495    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3496    '''
 3497    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3498    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3499    '''
 3500    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3501    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3502    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3503    ''' </param>
 3504    ''' <param name="eventType">
 3505    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3506    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3507    ''' </param>
 3508    ''' <param name="eventID">
 3509    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3510    ''' </param>
 3511    ''' <param name="category">
 3512    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3513    ''' </param>
 3514    ''' <param name="rawData">
 3515    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 3516    ''' </param>
 3517    ''' <param name="maxKilobytes">
 3518    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3519    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3520    ''' </param>
 3521    ''' <param name="retentionDays">
 3522    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3523    ''' Only used when creating a new log.
 3524    ''' </param>
 3525    ''' <remarks>
 3526    ''' <para>
 3527    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3528    ''' </para>
 3529    ''' <para>
 3530    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3531    ''' </para>
 3532    ''' </remarks>
 63533    Public Sub Log(
 63534            ByVal logName As String,
 63535            ByVal source As String,
 63536            ByVal message As String,
 63537            ByVal eventType As EventLogEntryType,
 63538            ByVal eventID As Integer,
 63539            ByVal category As Short,
 63540            ByVal rawData As Byte(),
 63541            ByVal maxKilobytes As Integer,
 63542            ByVal retentionDays As Integer)
 3543
 123544        Log(
 123545            "",
 123546            logName,
 123547            source,
 123548            message,
 123549            eventType,
 123550            eventID,
 123551            category,
 123552            rawData,
 123553            maxKilobytes,
 123554            retentionDays)
 3555
 123556    End Sub
 3557
 3558    ''' <summary>
 3559    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3560    ''' </summary>
 3561    ''' <param name="logName">
 3562    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 3563    ''' If <c>null</c> or empty, "Application" is used by default.
 3564    ''' </param>
 3565    ''' <param name="source">
 3566    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 3567    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 3568    ''' </param>
 3569    ''' <param name="message">
 3570    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3571    '''
 3572    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3573    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3574    '''
 3575    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3576    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3577    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3578    ''' </param>
 3579    ''' <param name="eventType">
 3580    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3581    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3582    ''' </param>
 3583    ''' <param name="eventID">
 3584    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3585    ''' </param>
 3586    ''' <param name="category">
 3587    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3588    ''' </param>
 3589    ''' <param name="rawData">
 3590    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 3591    ''' </param>
 3592    ''' <param name="maxKilobytes">
 3593    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3594    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3595    ''' </param>
 3596    ''' <param name="retentionDays">
 3597    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3598    ''' Only used when creating a new log.
 3599    ''' </param>
 3600    ''' <param name="EntrySeverity">
 3601    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 3602    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 3603    ''' will be skipped and not written to the Event Log.
 3604    ''' </param>
 3605    ''' <remarks>
 3606    ''' <para>
 3607    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3608    ''' </para>
 3609    ''' <para>
 3610    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3611    ''' </para>
 3612    ''' </remarks>
 63613    Public Sub Log(
 63614            ByVal logName As String,
 63615            ByVal source As String,
 63616            ByVal message As String,
 63617            ByVal eventType As EventLogEntryType,
 63618            ByVal eventID As Integer,
 63619            ByVal category As Short,
 63620            ByVal rawData As Byte(),
 63621            ByVal maxKilobytes As Integer,
 63622            ByVal retentionDays As Integer,
 63623            ByVal EntrySeverity As LoggingSeverity)
 3624
 123625        Log(
 123626            "",
 123627            logName,
 123628            source,
 123629            message,
 123630            eventType,
 123631            eventID,
 123632            category,
 123633            rawData,
 123634            maxKilobytes,
 123635            retentionDays,
 123636            EntrySeverity)
 3637
 123638    End Sub
 3639
 3640    ''' <summary>
 3641    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3642    ''' </summary>
 3643    ''' <param name="logName">
 3644    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 3645    ''' If <c>null</c> or empty, "Application" is used by default.
 3646    ''' </param>
 3647    ''' <param name="source">
 3648    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 3649    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 3650    ''' </param>
 3651    ''' <param name="message">
 3652    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3653    '''
 3654    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3655    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3656    '''
 3657    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3658    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3659    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3660    ''' </param>
 3661    ''' <param name="eventType">
 3662    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3663    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3664    ''' </param>
 3665    ''' <param name="eventID">
 3666    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3667    ''' </param>
 3668    ''' <param name="category">
 3669    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3670    ''' </param>
 3671    ''' <param name="rawData">
 3672    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 3673    ''' </param>
 3674    ''' <param name="maxKilobytes">
 3675    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3676    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3677    ''' </param>
 3678    ''' <param name="retentionDays">
 3679    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3680    ''' Only used when creating a new log.
 3681    ''' </param>
 3682    ''' <remarks>
 3683    ''' <para>
 3684    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3685    ''' </para>
 3686    ''' <para>
 3687    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3688    ''' </para>
 3689    ''' </remarks>
 1143690    Public Sub Log(
 1143691            ByVal machineName As String,
 1143692            ByVal logName As String,
 1143693            ByVal source As String,
 1143694            ByVal message As String,
 1143695            ByVal eventType As EventLogEntryType,
 1143696            ByVal eventID As Integer,
 1143697            ByVal category As Short,
 1143698            ByVal rawData As Byte(),
 1143699            ByVal maxKilobytes As Integer,
 1143700            ByVal retentionDays As Integer)
 3701
 2283702        Initialize()
 3703
 2283704        Log(
 2283705            machineName,
 2283706            logName,
 2283707            source,
 2283708            message,
 2283709            eventType,
 2283710            eventID,
 2283711            category,
 2283712            rawData,
 2283713            maxKilobytes,
 2283714            retentionDays,
 2283715            WriteInitEntry)
 3716
 2283717    End Sub
 3718
 3719    ''' <summary>
 3720    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3721    ''' </summary>
 3722    ''' <param name="logName">
 3723    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 3724    ''' If <c>null</c> or empty, "Application" is used by default.
 3725    ''' </param>
 3726    ''' <param name="source">
 3727    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 3728    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 3729    ''' </param>
 3730    ''' <param name="message">
 3731    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3732    '''
 3733    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3734    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3735    '''
 3736    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3737    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3738    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3739    ''' </param>
 3740    ''' <param name="eventType">
 3741    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3742    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3743    ''' </param>
 3744    ''' <param name="eventID">
 3745    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 3746    ''' </param>
 3747    ''' <param name="category">
 3748    ''' The category for the event, if applicable. This is typically used in categorized event views.
 3749    ''' </param>
 3750    ''' <param name="rawData">
 3751    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 3752    ''' </param>
 3753    ''' <param name="maxKilobytes">
 3754    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3755    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3756    ''' </param>
 3757    ''' <param name="retentionDays">
 3758    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3759    ''' Only used when creating a new log.
 3760    ''' </param>
 3761    ''' <param name="EntrySeverity">
 3762    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 3763    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 3764    ''' will be skipped and not written to the Event Log.
 3765    ''' </param>
 3766    ''' <remarks>
 3767    ''' <para>
 3768    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3769    ''' </para>
 3770    ''' <para>
 3771    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3772    ''' </para>
 3773    ''' </remarks>
 1323774    Public Sub Log(
 1323775            ByVal machineName As String,
 1323776            ByVal logName As String,
 1323777            ByVal source As String,
 1323778            ByVal message As String,
 1323779            ByVal eventType As EventLogEntryType,
 1323780            ByVal eventID As Integer,
 1323781            ByVal category As Short,
 1323782            ByVal rawData As Byte(),
 1323783            ByVal maxKilobytes As Integer,
 1323784            ByVal retentionDays As Integer,
 1323785            ByVal EntrySeverity As LoggingSeverity)
 3786
 2643787        Initialize()
 2643788        Log(
 2643789            machineName,
 2643790            logName,
 2643791            source,
 2643792            message,
 2643793            eventType,
 2643794            eventID,
 2643795            category,
 2643796            rawData,
 2643797            maxKilobytes,
 2643798            retentionDays,
 2643799            WriteInitEntry,
 2643800            EntrySeverity)
 3801
 2643802    End Sub
 3803
 3804    ''' <summary>
 3805    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3806    ''' </summary>
 3807    ''' <param name="message">
 3808    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3809    '''
 3810    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3811    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3812    '''
 3813    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3814    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3815    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3816    ''' </param>
 3817    ''' <param name="maxKilobytes">
 3818    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3819    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3820    ''' </param>
 3821    ''' <param name="retentionDays">
 3822    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3823    ''' Only used when creating a new log.
 3824    ''' </param>
 3825    ''' <param name="writeInitEntry">
 3826    ''' Indicates whether an initialization entry should be written when a new log is created.
 3827    ''' </param>
 3828    ''' <remarks>
 3829    ''' <para>
 3830    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3831    ''' </para>
 3832    ''' <para>
 3833    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3834    ''' </para>
 3835    ''' </remarks>
 63836    Public Sub Log(
 63837            ByVal message As String,
 63838            ByVal maxKilobytes As Integer,
 63839            ByVal retentionDays As Integer,
 63840            ByVal writeInitEntry As Boolean)
 3841
 123842        Log(
 123843            message,
 123844            EventLogEntryType.Information,
 123845            maxKilobytes,
 123846            retentionDays,
 123847            writeInitEntry)
 3848
 123849    End Sub
 3850
 3851    ''' <summary>
 3852    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3853    ''' </summary>
 3854    ''' <param name="message">
 3855    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3856    '''
 3857    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3858    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3859    '''
 3860    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3861    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3862    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3863    ''' </param>
 3864    ''' <param name="maxKilobytes">
 3865    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3866    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3867    ''' </param>
 3868    ''' <param name="retentionDays">
 3869    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3870    ''' Only used when creating a new log.
 3871    ''' </param>
 3872    ''' <param name="writeInitEntry">
 3873    ''' Indicates whether an initialization entry should be written when a new log is created.
 3874    ''' </param>
 3875    ''' <param name="EntrySeverity">
 3876    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 3877    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 3878    ''' will be skipped and not written to the Event Log.
 3879    ''' </param>
 3880    ''' <remarks>
 3881    ''' <para>
 3882    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3883    ''' </para>
 3884    ''' <para>
 3885    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3886    ''' </para>
 3887    ''' </remarks>
 63888    Public Sub Log(
 63889            ByVal message As String,
 63890            ByVal maxKilobytes As Integer,
 63891            ByVal retentionDays As Integer,
 63892            ByVal writeInitEntry As Boolean,
 63893            ByVal EntrySeverity As LoggingSeverity)
 3894
 123895        Log(
 123896            message,
 123897            EventLogEntryType.Information,
 123898            maxKilobytes,
 123899            retentionDays,
 123900            writeInitEntry,
 123901            EntrySeverity)
 3902
 123903    End Sub
 3904
 3905    ''' <summary>
 3906    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3907    ''' </summary>
 3908    ''' <param name="message">
 3909    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3910    '''
 3911    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3912    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3913    '''
 3914    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3915    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3916    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3917    ''' </param>
 3918    ''' <param name="eventType">
 3919    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3920    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3921    ''' </param>
 3922    ''' <param name="maxKilobytes">
 3923    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3924    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3925    ''' </param>
 3926    ''' <param name="retentionDays">
 3927    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3928    ''' Only used when creating a new log.
 3929    ''' </param>
 3930    ''' <param name="writeInitEntry">
 3931    ''' Indicates whether an initialization entry should be written when a new log is created.
 3932    ''' </param>
 3933    ''' <remarks>
 3934    ''' <para>
 3935    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3936    ''' </para>
 3937    ''' <para>
 3938    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3939    ''' </para>
 3940    ''' </remarks>
 63941    Public Sub Log(
 63942            ByVal message As String,
 63943            ByVal eventType As EventLogEntryType,
 63944            ByVal maxKilobytes As Integer,
 63945            ByVal retentionDays As Integer,
 63946            ByVal writeInitEntry As Boolean)
 3947
 123948        Log(
 123949            message,
 123950            eventType,
 123951            0,
 123952            maxKilobytes,
 123953            retentionDays,
 123954            writeInitEntry)
 3955
 123956    End Sub
 3957
 3958    ''' <summary>
 3959    ''' Writes an entry to the Windows Event Log using the provided parameters.
 3960    ''' </summary>
 3961    ''' <param name="message">
 3962    ''' The message to log. If <c>null</c> or empty, a default message is used.
 3963    '''
 3964    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 3965    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 3966    '''
 3967    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 3968    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 3969    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 3970    ''' </param>
 3971    ''' <param name="eventType">
 3972    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 3973    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 3974    ''' </param>
 3975    ''' <param name="maxKilobytes">
 3976    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3977    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3978    ''' </param>
 3979    ''' <param name="retentionDays">
 3980    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3981    ''' Only used when creating a new log.
 3982    ''' </param>
 3983    ''' <param name="writeInitEntry">
 3984    ''' Indicates whether an initialization entry should be written when a new log is created.
 3985    ''' </param>
 3986    ''' <param name="EntrySeverity">
 3987    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 3988    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 3989    ''' will be skipped and not written to the Event Log.
 3990    ''' </param>
 3991    ''' <remarks>
 3992    ''' <para>
 3993    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 3994    ''' </para>
 3995    ''' <para>
 3996    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 3997    ''' </para>
 3998    ''' </remarks>
 63999    Public Sub Log(
 64000            ByVal message As String,
 64001            ByVal eventType As EventLogEntryType,
 64002            ByVal maxKilobytes As Integer,
 64003            ByVal retentionDays As Integer,
 64004            ByVal writeInitEntry As Boolean,
 64005            ByVal EntrySeverity As LoggingSeverity)
 4006
 124007        Log(
 124008            message,
 124009            eventType,
 124010            0,
 124011            maxKilobytes,
 124012            retentionDays,
 124013            writeInitEntry,
 124014            EntrySeverity)
 4015
 124016    End Sub
 4017
 4018    ''' <summary>
 4019    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4020    ''' </summary>
 4021    ''' <param name="message">
 4022    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4023    '''
 4024    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4025    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4026    '''
 4027    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4028    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4029    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4030    ''' </param>
 4031    ''' <param name="eventType">
 4032    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4033    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4034    ''' </param>
 4035    ''' <param name="eventID">
 4036    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4037    ''' </param>
 4038    ''' <param name="maxKilobytes">
 4039    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4040    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4041    ''' </param>
 4042    ''' <param name="retentionDays">
 4043    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4044    ''' Only used when creating a new log.
 4045    ''' </param>
 4046    ''' <param name="writeInitEntry">
 4047    ''' Indicates whether an initialization entry should be written when a new log is created.
 4048    ''' </param>
 4049    ''' <remarks>
 4050    ''' <para>
 4051    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4052    ''' </para>
 4053    ''' <para>
 4054    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4055    ''' </para>
 4056    ''' </remarks>
 64057    Public Sub Log(
 64058            ByVal message As String,
 64059            ByVal eventType As EventLogEntryType,
 64060            ByVal eventID As Integer,
 64061            ByVal maxKilobytes As Integer,
 64062            ByVal retentionDays As Integer,
 64063            ByVal writeInitEntry As Boolean)
 4064
 124065        Log(
 124066            message,
 124067            eventType,
 124068            eventID,
 124069            0,
 124070            maxKilobytes,
 124071            retentionDays,
 124072            writeInitEntry)
 4073
 124074    End Sub
 4075
 4076    ''' <summary>
 4077    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4078    ''' </summary>
 4079    ''' <param name="message">
 4080    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4081    '''
 4082    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4083    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4084    '''
 4085    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4086    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4087    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4088    ''' </param>
 4089    ''' <param name="eventType">
 4090    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4091    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4092    ''' </param>
 4093    ''' <param name="eventID">
 4094    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4095    ''' </param>
 4096    ''' <param name="maxKilobytes">
 4097    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4098    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4099    ''' </param>
 4100    ''' <param name="retentionDays">
 4101    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4102    ''' Only used when creating a new log.
 4103    ''' </param>
 4104    ''' <param name="writeInitEntry">
 4105    ''' Indicates whether an initialization entry should be written when a new log is created.
 4106    ''' </param>
 4107    ''' <param name="EntrySeverity">
 4108    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 4109    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 4110    ''' will be skipped and not written to the Event Log.
 4111    ''' </param>
 4112    ''' <remarks>
 4113    ''' <para>
 4114    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4115    ''' </para>
 4116    ''' <para>
 4117    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4118    ''' </para>
 4119    ''' </remarks>
 64120    Public Sub Log(
 64121            ByVal message As String,
 64122            ByVal eventType As EventLogEntryType,
 64123            ByVal eventID As Integer,
 64124            ByVal maxKilobytes As Integer,
 64125            ByVal retentionDays As Integer,
 64126            ByVal writeInitEntry As Boolean,
 64127            ByVal EntrySeverity As LoggingSeverity)
 4128
 124129        Log(
 124130            message,
 124131            eventType,
 124132            eventID,
 124133            0,
 124134            maxKilobytes,
 124135            retentionDays,
 124136            writeInitEntry,
 124137            EntrySeverity)
 4138
 124139    End Sub
 4140
 4141    ''' <summary>
 4142    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4143    ''' </summary>
 4144    ''' <param name="message">
 4145    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4146    '''
 4147    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4148    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4149    '''
 4150    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4151    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4152    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4153    ''' </param>
 4154    ''' <param name="eventType">
 4155    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4156    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4157    ''' </param>
 4158    ''' <param name="eventID">
 4159    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4160    ''' </param>
 4161    ''' <param name="category">
 4162    ''' The category for the event, if applicable. This is typically used in categorized event views.
 4163    ''' </param>
 4164    ''' <param name="maxKilobytes">
 4165    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4166    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4167    ''' </param>
 4168    ''' <param name="retentionDays">
 4169    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4170    ''' Only used when creating a new log.
 4171    ''' </param>
 4172    ''' <param name="writeInitEntry">
 4173    ''' Indicates whether an initialization entry should be written when a new log is created.
 4174    ''' </param>
 4175    ''' <remarks>
 4176    ''' <para>
 4177    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4178    ''' </para>
 4179    ''' <para>
 4180    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4181    ''' </para>
 4182    ''' </remarks>
 64183    Public Sub Log(
 64184            ByVal message As String,
 64185            ByVal eventType As EventLogEntryType,
 64186            ByVal eventID As Integer,
 64187            ByVal category As Short,
 64188            ByVal maxKilobytes As Integer,
 64189            ByVal retentionDays As Integer,
 64190            ByVal writeInitEntry As Boolean)
 4191
 124192        Log(
 124193            message,
 124194            eventType,
 124195            eventID,
 124196            category,
 124197            Nothing,
 124198            maxKilobytes,
 124199            retentionDays,
 124200            writeInitEntry)
 4201
 124202    End Sub
 4203
 4204    ''' <summary>
 4205    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4206    ''' </summary>
 4207    ''' <param name="message">
 4208    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4209    '''
 4210    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4211    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4212    '''
 4213    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4214    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4215    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4216    ''' </param>
 4217    ''' <param name="eventType">
 4218    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4219    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4220    ''' </param>
 4221    ''' <param name="eventID">
 4222    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4223    ''' </param>
 4224    ''' <param name="category">
 4225    ''' The category for the event, if applicable. This is typically used in categorized event views.
 4226    ''' </param>
 4227    ''' <param name="maxKilobytes">
 4228    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4229    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4230    ''' </param>
 4231    ''' <param name="retentionDays">
 4232    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4233    ''' Only used when creating a new log.
 4234    ''' </param>
 4235    ''' <param name="writeInitEntry">
 4236    ''' Indicates whether an initialization entry should be written when a new log is created.
 4237    ''' </param>
 4238    ''' <param name="EntrySeverity">
 4239    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 4240    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 4241    ''' will be skipped and not written to the Event Log.
 4242    ''' </param>
 4243    ''' <remarks>
 4244    ''' <para>
 4245    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4246    ''' </para>
 4247    ''' <para>
 4248    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4249    ''' </para>
 4250    ''' </remarks>
 64251    Public Sub Log(
 64252            ByVal message As String,
 64253            ByVal eventType As EventLogEntryType,
 64254            ByVal eventID As Integer,
 64255            ByVal category As Short,
 64256            ByVal maxKilobytes As Integer,
 64257            ByVal retentionDays As Integer,
 64258            ByVal writeInitEntry As Boolean,
 64259            ByVal EntrySeverity As LoggingSeverity)
 4260
 124261        Log(
 124262            message,
 124263            eventType,
 124264            eventID,
 124265            category,
 124266            Nothing,
 124267            maxKilobytes,
 124268            retentionDays,
 124269            writeInitEntry,
 124270            EntrySeverity)
 4271
 124272    End Sub
 4273
 4274    ''' <summary>
 4275    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4276    ''' </summary>
 4277    ''' <param name="message">
 4278    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4279    '''
 4280    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4281    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4282    '''
 4283    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4284    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4285    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4286    ''' </param>
 4287    ''' <param name="eventType">
 4288    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4289    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4290    ''' </param>
 4291    ''' <param name="eventID">
 4292    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4293    ''' </param>
 4294    ''' <param name="category">
 4295    ''' The category for the event, if applicable. This is typically used in categorized event views.
 4296    ''' </param>
 4297    ''' <param name="rawData">
 4298    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 4299    ''' </param>
 4300    ''' <param name="maxKilobytes">
 4301    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4302    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4303    ''' </param>
 4304    ''' <param name="retentionDays">
 4305    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4306    ''' Only used when creating a new log.
 4307    ''' </param>
 4308    ''' <param name="writeInitEntry">
 4309    ''' Indicates whether an initialization entry should be written when a new log is created.
 4310    ''' </param>
 4311    ''' <remarks>
 4312    ''' <para>
 4313    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4314    ''' </para>
 4315    ''' <para>
 4316    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4317    ''' </para>
 4318    ''' </remarks>
 64319    Public Sub Log(
 64320            ByVal message As String,
 64321            ByVal eventType As EventLogEntryType,
 64322            ByVal eventID As Integer,
 64323            ByVal category As Short,
 64324            ByVal rawData As Byte(),
 64325            ByVal maxKilobytes As Integer,
 64326            ByVal retentionDays As Integer,
 64327            ByVal writeInitEntry As Boolean)
 4328
 124329        Log(
 124330            "",
 124331            message,
 124332            eventType,
 124333            eventID,
 124334            category,
 124335            rawData,
 124336            maxKilobytes,
 124337            retentionDays,
 124338            writeInitEntry)
 4339
 124340    End Sub
 4341
 4342    ''' <summary>
 4343    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4344    ''' </summary>
 4345    ''' <param name="message">
 4346    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4347    '''
 4348    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4349    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4350    '''
 4351    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4352    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4353    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4354    ''' </param>
 4355    ''' <param name="eventType">
 4356    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4357    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4358    ''' </param>
 4359    ''' <param name="eventID">
 4360    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4361    ''' </param>
 4362    ''' <param name="category">
 4363    ''' The category for the event, if applicable. This is typically used in categorized event views.
 4364    ''' </param>
 4365    ''' <param name="rawData">
 4366    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 4367    ''' </param>
 4368    ''' <param name="maxKilobytes">
 4369    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4370    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4371    ''' </param>
 4372    ''' <param name="retentionDays">
 4373    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4374    ''' Only used when creating a new log.
 4375    ''' </param>
 4376    ''' <param name="writeInitEntry">
 4377    ''' Indicates whether an initialization entry should be written when a new log is created.
 4378    ''' </param>
 4379    ''' <param name="EntrySeverity">
 4380    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 4381    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 4382    ''' will be skipped and not written to the Event Log.
 4383    ''' </param>
 4384    ''' <remarks>
 4385    ''' <para>
 4386    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4387    ''' </para>
 4388    ''' <para>
 4389    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4390    ''' </para>
 4391    ''' </remarks>
 64392    Public Sub Log(
 64393            ByVal message As String,
 64394            ByVal eventType As EventLogEntryType,
 64395            ByVal eventID As Integer,
 64396            ByVal category As Short,
 64397            ByVal rawData As Byte(),
 64398            ByVal maxKilobytes As Integer,
 64399            ByVal retentionDays As Integer,
 64400            ByVal writeInitEntry As Boolean,
 64401            ByVal EntrySeverity As LoggingSeverity)
 4402
 124403        Log(
 124404            "",
 124405            message,
 124406            eventType,
 124407            eventID,
 124408            category,
 124409            rawData,
 124410            maxKilobytes,
 124411            retentionDays,
 124412            writeInitEntry,
 124413            EntrySeverity)
 4414
 124415    End Sub
 4416
 4417    ''' <summary>
 4418    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4419    ''' </summary>
 4420    ''' <param name="sourceName">
 4421    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 4422    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 4423    ''' </param>
 4424    ''' <param name="message">
 4425    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4426    '''
 4427    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4428    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4429    '''
 4430    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4431    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4432    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4433    ''' </param>
 4434    ''' <param name="eventType">
 4435    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4436    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4437    ''' </param>
 4438    ''' <param name="eventID">
 4439    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4440    ''' </param>
 4441    ''' <param name="category">
 4442    ''' The category for the event, if applicable. This is typically used in categorized event views.
 4443    ''' </param>
 4444    ''' <param name="rawData">
 4445    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 4446    ''' </param>
 4447    ''' <param name="maxKilobytes">
 4448    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4449    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4450    ''' </param>
 4451    ''' <param name="retentionDays">
 4452    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4453    ''' Only used when creating a new log.
 4454    ''' </param>
 4455    ''' <param name="writeInitEntry">
 4456    ''' Indicates whether an initialization entry should be written when a new log is created.
 4457    ''' </param>
 4458    ''' <remarks>
 4459    ''' <para>
 4460    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4461    ''' </para>
 4462    ''' <para>
 4463    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4464    ''' </para>
 4465    ''' </remarks>
 64466    Public Sub Log(
 64467            ByVal sourceName As String,
 64468            ByVal message As String,
 64469            ByVal eventType As EventLogEntryType,
 64470            ByVal eventID As Integer,
 64471            ByVal category As Short,
 64472            ByVal rawData As Byte(),
 64473            ByVal maxKilobytes As Integer,
 64474            ByVal retentionDays As Integer,
 64475            ByVal writeInitEntry As Boolean)
 4476
 124477        Log(
 124478            "",
 124479            sourceName,
 124480            message,
 124481            eventType,
 124482            eventID,
 124483            category,
 124484            rawData,
 124485            maxKilobytes,
 124486            retentionDays,
 124487            writeInitEntry)
 4488
 124489    End Sub
 4490
 4491    ''' <summary>
 4492    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4493    ''' </summary>
 4494    ''' <param name="sourceName">
 4495    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 4496    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 4497    ''' </param>
 4498    ''' <param name="message">
 4499    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4500    '''
 4501    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4502    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4503    '''
 4504    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4505    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4506    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4507    ''' </param>
 4508    ''' <param name="eventType">
 4509    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4510    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4511    ''' </param>
 4512    ''' <param name="eventID">
 4513    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4514    ''' </param>
 4515    ''' <param name="category">
 4516    ''' The category for the event, if applicable. This is typically used in categorized event views.
 4517    ''' </param>
 4518    ''' <param name="rawData">
 4519    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 4520    ''' </param>
 4521    ''' <param name="maxKilobytes">
 4522    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4523    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4524    ''' </param>
 4525    ''' <param name="retentionDays">
 4526    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4527    ''' Only used when creating a new log.
 4528    ''' </param>
 4529    ''' <param name="writeInitEntry">
 4530    ''' Indicates whether an initialization entry should be written when a new log is created.
 4531    ''' </param>
 4532    ''' <param name="EntrySeverity">
 4533    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 4534    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 4535    ''' will be skipped and not written to the Event Log.
 4536    ''' </param>
 4537    ''' <remarks>
 4538    ''' <para>
 4539    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4540    ''' </para>
 4541    ''' <para>
 4542    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4543    ''' </para>
 4544    ''' </remarks>
 64545    Public Sub Log(
 64546            ByVal sourceName As String,
 64547            ByVal message As String,
 64548            ByVal eventType As EventLogEntryType,
 64549            ByVal eventID As Integer,
 64550            ByVal category As Short,
 64551            ByVal rawData As Byte(),
 64552            ByVal maxKilobytes As Integer,
 64553            ByVal retentionDays As Integer,
 64554            ByVal writeInitEntry As Boolean,
 64555            ByVal EntrySeverity As LoggingSeverity)
 4556
 124557        Log(
 124558            "",
 124559            sourceName,
 124560            message,
 124561            eventType,
 124562            eventID,
 124563            category,
 124564            rawData,
 124565            maxKilobytes,
 124566            retentionDays,
 124567            writeInitEntry,
 124568            EntrySeverity)
 4569
 124570    End Sub
 4571
 4572    ''' <summary>
 4573    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4574    ''' </summary>
 4575    ''' <param name="logName">
 4576    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 4577    ''' If <c>null</c> or empty, "Application" is used by default.
 4578    ''' </param>
 4579    ''' <param name="sourceName">
 4580    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 4581    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 4582    ''' </param>
 4583    ''' <param name="message">
 4584    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4585    '''
 4586    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4587    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4588    '''
 4589    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4590    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4591    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4592    ''' </param>
 4593    ''' <param name="eventType">
 4594    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4595    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4596    ''' </param>
 4597    ''' <param name="eventID">
 4598    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4599    ''' </param>
 4600    ''' <param name="category">
 4601    ''' The category for the event, if applicable. This is typically used in categorized event views.
 4602    ''' </param>
 4603    ''' <param name="rawData">
 4604    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 4605    ''' </param>
 4606    ''' <param name="maxKilobytes">
 4607    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4608    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4609    ''' </param>
 4610    ''' <param name="retentionDays">
 4611    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4612    ''' Only used when creating a new log.
 4613    ''' </param>
 4614    ''' <param name="writeInitEntry">
 4615    ''' Indicates whether an initialization entry should be written when a new log is created.
 4616    ''' </param>
 4617    ''' <remarks>
 4618    ''' <para>
 4619    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4620    ''' </para>
 4621    ''' <para>
 4622    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4623    ''' </para>
 4624    ''' </remarks>
 64625    Public Sub Log(
 64626            ByVal logName As String,
 64627            ByVal sourceName As String,
 64628            ByVal message As String,
 64629            ByVal eventType As EventLogEntryType,
 64630            ByVal eventID As Integer,
 64631            ByVal category As Short,
 64632            ByVal rawData As Byte(),
 64633            ByVal maxKilobytes As Integer,
 64634            ByVal retentionDays As Integer,
 64635            ByVal writeInitEntry As Boolean)
 4636
 124637        Log(
 124638            "",
 124639            logName,
 124640            sourceName,
 124641            message,
 124642            eventType,
 124643            eventID,
 124644            category,
 124645            rawData,
 124646            maxKilobytes,
 124647            retentionDays,
 124648            writeInitEntry)
 4649
 124650    End Sub
 4651
 4652    ''' <summary>
 4653    ''' Writes an entry to the Windows Event Log using the provided parameters.
 4654    ''' </summary>
 4655    ''' <param name="logName">
 4656    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 4657    ''' If <c>null</c> or empty, "Application" is used by default.
 4658    ''' </param>
 4659    ''' <param name="sourceName">
 4660    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 4661    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 4662    ''' </param>
 4663    ''' <param name="message">
 4664    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4665    '''
 4666    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4667    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4668    '''
 4669    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4670    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4671    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4672    ''' </param>
 4673    ''' <param name="eventType">
 4674    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4675    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4676    ''' </param>
 4677    ''' <param name="eventID">
 4678    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 4679    ''' </param>
 4680    ''' <param name="category">
 4681    ''' The category for the event, if applicable. This is typically used in categorized event views.
 4682    ''' </param>
 4683    ''' <param name="rawData">
 4684    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 4685    ''' </param>
 4686    ''' <param name="maxKilobytes">
 4687    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 4688    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 4689    ''' </param>
 4690    ''' <param name="retentionDays">
 4691    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 4692    ''' Only used when creating a new log.
 4693    ''' </param>
 4694    ''' <param name="writeInitEntry">
 4695    ''' Indicates whether an initialization entry should be written when a new log is created.
 4696    ''' </param>
 4697    ''' <param name="EntrySeverity">
 4698    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 4699    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 4700    ''' will be skipped and not written to the Event Log.
 4701    ''' </param>
 4702    ''' <remarks>
 4703    ''' <para>
 4704    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4705    ''' </para>
 4706    ''' <para>
 4707    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4708    ''' </para>
 4709    ''' </remarks>
 64710    Public Sub Log(
 64711            ByVal logName As String,
 64712            ByVal sourceName As String,
 64713            ByVal message As String,
 64714            ByVal eventType As EventLogEntryType,
 64715            ByVal eventID As Integer,
 64716            ByVal category As Short,
 64717            ByVal rawData As Byte(),
 64718            ByVal maxKilobytes As Integer,
 64719            ByVal retentionDays As Integer,
 64720            ByVal writeInitEntry As Boolean,
 64721            ByVal EntrySeverity As LoggingSeverity)
 4722
 124723        Log(
 124724            "",
 124725            logName,
 124726            sourceName,
 124727            message,
 124728            eventType,
 124729            eventID,
 124730            category,
 124731            rawData,
 124732            maxKilobytes,
 124733            retentionDays,
 124734            writeInitEntry,
 124735            EntrySeverity)
 4736
 124737    End Sub
 4738
 4739    ''' <summary>
 4740    ''' Writes an entry (or entries) to the Windows Event Log using the specified parameters.
 4741    ''' </summary>
 4742    ''' <param name="targetMachineName">
 4743    ''' The name of the machine where the event log resides. Use <c>"."</c> for the local machine.
 4744    ''' If <c>null</c> or empty, the local machine is used by default, or the value of the <see cref="MachineName"/> pro
 4745    ''' </param>
 4746    ''' <param name="targetLogName">
 4747    ''' The name of the event log (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 4748    ''' If <c>null</c> or empty, the value of the <see cref="LogName"/> property is used.
 4749    ''' </param>
 4750    ''' <param name="sourceName">
 4751    ''' The source name for the event entry. If <c>null</c> or empty, a source is auto-generated from the calling method
 4752    ''' If the resulting name exceeds 254 characters, it will be truncated.
 4753    ''' </param>
 4754    ''' <param name="message">
 4755    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4756    '''
 4757    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4758    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4759    '''
 4760    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4761    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4762    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4763    ''' </param>
 4764    ''' <param name="eventType">
 4765    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4766    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4767    ''' </param>
 4768    ''' <param name="eventID">
 4769    ''' The numeric event identifier. Application-defined and useful for grouping related events.
 4770    ''' </param>
 4771    ''' <param name="category">
 4772    ''' The category ID for the event. Use 0 if not applicable.
 4773    ''' </param>
 4774    ''' <param name="rawData">
 4775    ''' Optional binary data to associate with the event. Can be <c>null</c>.
 4776    ''' </param>
 4777    ''' <param name="maxKilobytes">
 4778    ''' The maximum size of the event log in kilobytes. Only applies when creating a new log. Range: 64 KB – 4 GB.
 4779    ''' </param>
 4780    ''' <param name="retentionDays">
 4781    ''' The number of days entries should be retained. 0 means entries are kept indefinitely.
 4782    ''' Applies only when creating a new log.
 4783    ''' </param>
 4784    ''' <param name="writeInitEntry">
 4785    ''' Whether to write an initialization entry when a new log is created.
 4786    ''' </param>
 4787    ''' <remarks>
 4788    ''' <para>
 4789    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4790    ''' </para>
 4791    ''' <para>
 4792    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4793    ''' </para>
 4794    ''' </remarks>
 1204795    Public Sub Log(
 1204796            ByVal targetMachineName As String,
 1204797            ByVal targetLogName As String,
 1204798            ByVal sourceName As String,
 1204799            ByVal message As String,
 1204800            ByVal eventType As EventLogEntryType,
 1204801            ByVal eventID As Integer,
 1204802            ByVal category As Short,
 1204803            ByVal rawData As Byte(),
 1204804            ByVal maxKilobytes As Integer,
 1204805            ByVal retentionDays As Integer,
 1204806            ByVal writeInitEntry As Boolean)
 4807
 2404808        Initialize()
 2404809        Log(
 2404810            targetMachineName,
 2404811            targetLogName,
 2404812            sourceName,
 2404813            message,
 2404814            eventType,
 2404815            eventID,
 2404816            category,
 2404817            rawData,
 2404818            maxKilobytes,
 2404819            retentionDays,
 2404820            writeInitEntry,
 2404821            LoggingSeverity)
 4822
 2404823    End Sub
 4824
 4825    ''' <summary>
 4826    ''' Writes an entry (or entries) to the Windows Event Log using the specified parameters.
 4827    ''' </summary>
 4828    ''' <param name="targetMachineName">
 4829    ''' The name of the machine where the event log resides. Use <c>"."</c> for the local machine.
 4830    ''' If <c>null</c> or empty, the local machine is used by default, or the value of the <see cref="MachineName"/> pro
 4831    ''' </param>
 4832    ''' <param name="targetLogName">
 4833    ''' The name of the event log (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 4834    ''' If <c>null</c> or empty, the value of the <see cref="LogName"/> property is used.
 4835    ''' </param>
 4836    ''' <param name="sourceName">
 4837    ''' The source name for the event entry. If <c>null</c> or empty, a source is auto-generated from the calling method
 4838    ''' If the resulting name exceeds 254 characters, it will be truncated.
 4839    ''' </param>
 4840    ''' <param name="message">
 4841    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4842    '''
 4843    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4844    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4845    '''
 4846    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4847    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4848    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4849    ''' </param>
 4850    ''' <param name="eventType">
 4851    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 4852    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 4853    ''' </param>
 4854    ''' <param name="eventID">
 4855    ''' The numeric event identifier. Application-defined and useful for grouping related events.
 4856    ''' </param>
 4857    ''' <param name="category">
 4858    ''' The category ID for the event. Use 0 if not applicable.
 4859    ''' </param>
 4860    ''' <param name="rawData">
 4861    ''' Optional binary data to associate with the event. Can be <c>null</c>.
 4862    ''' </param>
 4863    ''' <param name="maxKilobytes">
 4864    ''' The maximum size of the event log in kilobytes. Only applies when creating a new log. Range: 64 KB – 4 GB.
 4865    ''' </param>
 4866    ''' <param name="retentionDays">
 4867    ''' The number of days entries should be retained. 0 means entries are kept indefinitely.
 4868    ''' Applies only when creating a new log.
 4869    ''' </param>
 4870    ''' <param name="writeInitEntry">
 4871    ''' Whether to write an initialization entry when a new log is created.
 4872    ''' </param>
 4873    ''' <param name="EntrySeverity">
 4874    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 4875    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 4876    ''' will be skipped and not written to the Event Log.
 4877    ''' </param>
 4878    ''' <remarks>
 4879    ''' <para>
 4880    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 4881    ''' </para>
 4882    ''' <para>
 4883    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 4884    ''' </para>
 4885    ''' </remarks>
 2584886    Public Sub Log(
 2584887            ByVal targetMachineName As String,
 2584888            ByVal targetLogName As String,
 2584889            ByVal sourceName As String,
 2584890            ByVal message As String,
 2584891            ByVal eventType As EventLogEntryType,
 2584892            ByVal eventID As Integer,
 2584893            ByVal category As Short,
 2584894            ByVal rawData As Byte(),
 2584895            ByVal maxKilobytes As Integer,
 2584896            ByVal retentionDays As Integer,
 2584897            ByVal writeInitEntry As Boolean,
 2584898            ByVal EntrySeverity As LoggingSeverity)
 4899
 5164900        Initialize()
 4901
 5224902        If EntrySeverity < CurrentLoggingLevel Then Exit Sub
 4903
 5044904        Dim defaultLog As String = If(String.IsNullOrEmpty(targetLogName), LogName, targetLogName.Trim())
 5044905        Dim defaultSource As String = Source(sourceName)
 5044906        Dim sourceToUse As String = defaultSource ' this is used to tell the process which source to actually use if we 
 5044907        Dim defaultMachine As String = NormalizeMachineName(targetMachineName)
 4908
 5044909        Dim finalEventType As EventLogEntryType = NormalizeEventType(eventType)
 4910
 5044911        If AllowMultiEntryMessages AndAlso message.Length > 32766 Then
 124912            For Each chunk As String In SplitMessageIntoPages(defaultSource, message)
 244913                _writer.WriteEntry(defaultMachine,
 244914                           defaultLog,
 244915                           sourceToUse,
 244916                           chunk,
 244917                           finalEventType,
 244918                           eventID,
 244919                           category,
 244920                           rawData,
 244921                           maxKilobytes,
 244922                           retentionDays,
 244923                           writeInitEntry)
 124924            Next
 2464925        Else
 4924926            _writer.WriteEntry(defaultMachine,
 4924927                               defaultLog,
 4924928                               sourceToUse,
 4924929                               NormalizeMessage(defaultSource, message),
 4924930                               finalEventType,
 4924931                               eventID,
 4924932                               category,
 4924933                               rawData,
 4924934                               maxKilobytes,
 4924935                               retentionDays,
 4924936                               writeInitEntry)
 2524937        End If
 4938
 5164939    End Sub
 4940
 4941#End Region
 4942
 4943#Region " Log Extension Methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 4944
 4945    ''' <summary>
 4946    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 4947    ''' </summary>
 4948    ''' <param name="eventLog">
 4949    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 4950    ''' with a valid log name and source.
 4951    ''' </param>
 4952    ''' <param name="message">
 4953    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4954    '''
 4955    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4956    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4957    '''
 4958    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4959    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4960    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4961    ''' </param>
 4962    ''' <remarks>
 4963    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 4964    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 4965    ''' to intercept and test log output without writing to the system Event Log.
 4966    ''' </remarks>
 4967    <Extension>
 64968    Public Sub LogEntry(
 64969            ByVal eventLog As EventLog,
 64970            ByVal message As String)
 4971
 124972        LogEntry(eventLog,
 124973                 message,
 124974                 EventLogEntryType.Information)
 4975
 124976    End Sub
 4977
 4978    ''' <summary>
 4979    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 4980    ''' </summary>
 4981    ''' <param name="eventLog">
 4982    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 4983    ''' with a valid log name and source.
 4984    ''' </param>
 4985    ''' <param name="message">
 4986    ''' The message to log. If <c>null</c> or empty, a default message is used.
 4987    '''
 4988    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 4989    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 4990    '''
 4991    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 4992    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 4993    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 4994    ''' </param>
 4995    ''' <param name="EntrySeverity">
 4996    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 4997    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 4998    ''' will be skipped and not written to the Event Log.
 4999    ''' </param>
 5000    ''' <remarks>
 5001    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5002    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5003    ''' to intercept and test log output without writing to the system Event Log.
 5004    ''' </remarks>
 5005    <Extension>
 305006    Public Sub LogEntry(
 305007            ByVal eventLog As EventLog,
 305008            ByVal message As String,
 305009            ByVal EntrySeverity As LoggingSeverity)
 5010
 605011        LogEntry(eventLog,
 605012                 message,
 605013                 EventLogEntryType.Information,
 605014                 EntrySeverity)
 5015
 605016    End Sub
 5017
 5018    ''' <summary>
 5019    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5020    ''' </summary>
 5021    ''' <param name="eventLog">
 5022    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5023    ''' with a valid log name and source.
 5024    ''' </param>
 5025    ''' <param name="message">
 5026    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5027    '''
 5028    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5029    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5030    '''
 5031    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5032    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5033    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5034    ''' </param>
 5035    ''' <param name="eventType">
 5036    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5037    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5038    ''' </param>
 5039    ''' <remarks>
 5040    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5041    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5042    ''' to intercept and test log output without writing to the system Event Log.
 5043    ''' </remarks>
 5044    <Extension>
 65045    Public Sub LogEntry(
 65046            ByVal eventLog As EventLog,
 65047            ByVal message As String,
 65048            ByVal eventType As EventLogEntryType)
 5049
 125050        LogEntry(eventLog,
 125051                 message,
 125052                 eventType,
 125053                 0)
 5054
 125055    End Sub
 5056
 5057    ''' <summary>
 5058    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5059    ''' </summary>
 5060    ''' <param name="eventLog">
 5061    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5062    ''' with a valid log name and source.
 5063    ''' </param>
 5064    ''' <param name="message">
 5065    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5066    '''
 5067    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5068    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5069    '''
 5070    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5071    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5072    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5073    ''' </param>
 5074    ''' <param name="eventType">
 5075    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5076    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5077    ''' </param>
 5078    ''' <param name="EntrySeverity">
 5079    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5080    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5081    ''' will be skipped and not written to the Event Log.
 5082    ''' </param>
 5083    ''' <remarks>
 5084    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5085    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5086    ''' to intercept and test log output without writing to the system Event Log.
 5087    ''' </remarks>
 5088    <Extension>
 305089    Public Sub LogEntry(
 305090            ByVal eventLog As EventLog,
 305091            ByVal message As String,
 305092            ByVal eventType As EventLogEntryType,
 305093            ByVal EntrySeverity As LoggingSeverity)
 5094
 605095        LogEntry(eventLog,
 605096                 message,
 605097                 eventType,
 605098                 0,
 605099                 EntrySeverity)
 5100
 605101    End Sub
 5102
 5103    ''' <summary>
 5104    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5105    ''' </summary>
 5106    ''' <param name="eventLog">
 5107    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5108    ''' with a valid log name and source.
 5109    ''' </param>
 5110    ''' <param name="message">
 5111    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5112    '''
 5113    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5114    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5115    '''
 5116    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5117    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5118    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5119    ''' </param>
 5120    ''' <param name="eventID">
 5121    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5122    ''' or filtering related log entries.
 5123    ''' </param>
 5124    ''' <remarks>
 5125    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5126    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5127    ''' to intercept and test log output without writing to the system Event Log.
 5128    ''' </remarks>
 5129    <Extension>
 65130    Public Sub LogEntry(
 65131            ByVal eventLog As EventLog,
 65132            ByVal message As String,
 65133            ByVal eventID As Integer)
 5134
 125135        LogEntry(eventLog,
 125136                 message,
 125137                 EventLogEntryType.Information,
 125138                 eventID)
 5139
 125140    End Sub
 5141
 5142    ''' <summary>
 5143    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5144    ''' </summary>
 5145    ''' <param name="eventLog">
 5146    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5147    ''' with a valid log name and source.
 5148    ''' </param>
 5149    ''' <param name="message">
 5150    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5151    '''
 5152    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5153    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5154    '''
 5155    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5156    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5157    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5158    ''' </param>
 5159    ''' <param name="eventID">
 5160    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5161    ''' or filtering related log entries.
 5162    ''' </param>
 5163    ''' <param name="EntrySeverity">
 5164    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5165    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5166    ''' will be skipped and not written to the Event Log.
 5167    ''' </param>
 5168    ''' <remarks>
 5169    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5170    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5171    ''' to intercept and test log output without writing to the system Event Log.
 5172    ''' </remarks>
 5173    <Extension>
 65174    Public Sub LogEntry(
 65175            ByVal eventLog As EventLog,
 65176            ByVal message As String,
 65177            ByVal eventID As Integer,
 65178            ByVal EntrySeverity As LoggingSeverity)
 5179
 125180        LogEntry(eventLog,
 125181                 message,
 125182                 EventLogEntryType.Information,
 125183                 eventID,
 125184                 EntrySeverity)
 5185
 125186    End Sub
 5187
 5188    ''' <summary>
 5189    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5190    ''' </summary>
 5191    ''' <param name="eventLog">
 5192    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5193    ''' with a valid log name and source.
 5194    ''' </param>
 5195    ''' <param name="message">
 5196    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5197    '''
 5198    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5199    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5200    '''
 5201    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5202    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5203    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5204    ''' </param>
 5205    ''' <param name="category">
 5206    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 5207    ''' Use 0 if no category is needed.
 5208    ''' </param>
 5209    ''' <remarks>
 5210    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5211    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5212    ''' to intercept and test log output without writing to the system Event Log.
 5213    ''' </remarks>
 5214    <Extension>
 65215    Public Sub LogEntry(
 65216            ByVal eventLog As EventLog,
 65217            ByVal message As String,
 65218            ByVal category As Short)
 5219
 125220        LogEntry(eventLog,
 125221                 message,
 125222                 EventLogEntryType.Information,
 125223                 category)
 5224
 125225    End Sub
 5226
 5227    ''' <summary>
 5228    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5229    ''' </summary>
 5230    ''' <param name="eventLog">
 5231    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5232    ''' with a valid log name and source.
 5233    ''' </param>
 5234    ''' <param name="message">
 5235    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5236    '''
 5237    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5238    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5239    '''
 5240    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5241    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5242    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5243    ''' </param>
 5244    ''' <param name="category">
 5245    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 5246    ''' Use 0 if no category is needed.
 5247    ''' </param>
 5248    ''' <param name="EntrySeverity">
 5249    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5250    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5251    ''' will be skipped and not written to the Event Log.
 5252    ''' </param>
 5253    ''' <remarks>
 5254    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5255    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5256    ''' to intercept and test log output without writing to the system Event Log.
 5257    ''' </remarks>
 5258    <Extension>
 65259    Public Sub LogEntry(
 65260            ByVal eventLog As EventLog,
 65261            ByVal message As String,
 65262            ByVal category As Short,
 65263            ByVal EntrySeverity As LoggingSeverity)
 5264
 125265        LogEntry(eventLog,
 125266                 message,
 125267                 EventLogEntryType.Information,
 125268                 category,
 125269                 EntrySeverity)
 5270
 125271    End Sub
 5272
 5273    ''' <summary>
 5274    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5275    ''' </summary>
 5276    ''' <param name="eventLog">
 5277    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5278    ''' with a valid log name and source.
 5279    ''' </param>
 5280    ''' <param name="message">
 5281    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5282    '''
 5283    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5284    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5285    '''
 5286    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5287    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5288    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5289    ''' </param>
 5290    ''' <param name="eventType">
 5291    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5292    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5293    ''' </param>
 5294    ''' <param name="eventID">
 5295    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5296    ''' or filtering related log entries.
 5297    ''' </param>
 5298    ''' <remarks>
 5299    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5300    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5301    ''' to intercept and test log output without writing to the system Event Log.
 5302    ''' </remarks>
 5303    <Extension>
 125304    Public Sub LogEntry(
 125305            ByVal eventLog As EventLog,
 125306            ByVal message As String,
 125307            ByVal eventType As EventLogEntryType,
 125308            ByVal eventID As Integer)
 5309
 245310        LogEntry(eventLog,
 245311                 message,
 245312                 eventType,
 245313                 eventID,
 245314                 0)
 5315
 245316    End Sub
 5317
 5318    ''' <summary>
 5319    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5320    ''' </summary>
 5321    ''' <param name="eventLog">
 5322    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5323    ''' with a valid log name and source.
 5324    ''' </param>
 5325    ''' <param name="message">
 5326    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5327    '''
 5328    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5329    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5330    '''
 5331    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5332    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5333    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5334    ''' </param>
 5335    ''' <param name="eventType">
 5336    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5337    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5338    ''' </param>
 5339    ''' <param name="eventID">
 5340    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5341    ''' or filtering related log entries.
 5342    ''' </param>
 5343    ''' <param name="EntrySeverity">
 5344    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5345    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5346    ''' will be skipped and not written to the Event Log.
 5347    ''' </param>
 5348    ''' <remarks>
 5349    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5350    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5351    ''' to intercept and test log output without writing to the system Event Log.
 5352    ''' </remarks>
 5353    <Extension>
 485354    Public Sub LogEntry(
 485355            ByVal eventLog As EventLog,
 485356            ByVal message As String,
 485357            ByVal eventType As EventLogEntryType,
 485358            ByVal eventID As Integer,
 485359            ByVal EntrySeverity As LoggingSeverity)
 5360
 965361        LogEntry(eventLog,
 965362                 message,
 965363                 eventType,
 965364                 eventID,
 965365                 0,
 965366                 EntrySeverity)
 5367
 965368    End Sub
 5369
 5370    ''' <summary>
 5371    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5372    ''' </summary>
 5373    ''' <param name="eventLog">
 5374    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5375    ''' with a valid log name and source.
 5376    ''' </param>
 5377    ''' <param name="message">
 5378    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5379    '''
 5380    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5381    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5382    '''
 5383    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5384    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5385    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5386    ''' </param>
 5387    ''' <param name="eventType">
 5388    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5389    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5390    ''' </param>
 5391    ''' <param name="category">
 5392    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 5393    ''' Use 0 if no category is needed.
 5394    ''' </param>
 5395    ''' <remarks>
 5396    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5397    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5398    ''' to intercept and test log output without writing to the system Event Log.
 5399    ''' </remarks>
 5400    <Extension>
 65401    Public Sub LogEntry(
 65402            ByVal eventLog As EventLog,
 65403            ByVal message As String,
 65404            ByVal eventType As EventLogEntryType,
 65405            ByVal category As Short)
 5406
 125407        LogEntry(eventLog,
 125408                 message,
 125409                 eventType,
 125410                 0,
 125411                 category)
 5412
 125413    End Sub
 5414
 5415    ''' <summary>
 5416    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5417    ''' </summary>
 5418    ''' <param name="eventLog">
 5419    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5420    ''' with a valid log name and source.
 5421    ''' </param>
 5422    ''' <param name="message">
 5423    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5424    '''
 5425    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5426    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5427    '''
 5428    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5429    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5430    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5431    ''' </param>
 5432    ''' <param name="eventType">
 5433    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5434    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5435    ''' </param>
 5436    ''' <param name="category">
 5437    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 5438    ''' Use 0 if no category is needed.
 5439    ''' </param>
 5440    ''' <param name="EntrySeverity">
 5441    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5442    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5443    ''' will be skipped and not written to the Event Log.
 5444    ''' </param>
 5445    ''' <remarks>
 5446    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5447    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5448    ''' to intercept and test log output without writing to the system Event Log.
 5449    ''' </remarks>
 5450    <Extension>
 65451    Public Sub LogEntry(
 65452            ByVal eventLog As EventLog,
 65453            ByVal message As String,
 65454            ByVal eventType As EventLogEntryType,
 65455            ByVal category As Short,
 65456            ByVal EntrySeverity As LoggingSeverity)
 5457
 125458        LogEntry(eventLog,
 125459                 message,
 125460                 eventType,
 125461                 0,
 125462                 category,
 125463                 EntrySeverity)
 5464
 125465    End Sub
 5466
 5467    ''' <summary>
 5468    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5469    ''' </summary>
 5470    ''' <param name="eventLog">
 5471    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5472    ''' with a valid log name and source.
 5473    ''' </param>
 5474    ''' <param name="message">
 5475    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5476    '''
 5477    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5478    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5479    '''
 5480    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5481    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5482    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5483    ''' </param>
 5484    ''' <param name="eventType">
 5485    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5486    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5487    ''' </param>
 5488    ''' <param name="eventID">
 5489    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5490    ''' or filtering related log entries.
 5491    ''' </param>
 5492    ''' <param name="category">
 5493    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 5494    ''' Use 0 if no category is needed.
 5495    ''' </param>
 5496    ''' <remarks>
 5497    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5498    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5499    ''' to intercept and test log output without writing to the system Event Log.
 5500    ''' </remarks>
 5501    <Extension>
 65502    Public Sub LogEntry(
 65503            ByVal eventLog As EventLog,
 65504            ByVal message As String,
 65505            ByVal eventType As EventLogEntryType,
 65506            ByVal eventID As Integer,
 65507            ByVal category As Short)
 5508
 125509        LogEntry(eventLog,
 125510                 message,
 125511                 eventType,
 125512                 eventID,
 125513                 category,
 125514                 CType(Nothing, Byte()))
 5515
 125516    End Sub
 5517
 5518    ''' <summary>
 5519    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5520    ''' </summary>
 5521    ''' <param name="eventLog">
 5522    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5523    ''' with a valid log name and source.
 5524    ''' </param>
 5525    ''' <param name="message">
 5526    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5527    '''
 5528    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5529    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5530    '''
 5531    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5532    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5533    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5534    ''' </param>
 5535    ''' <param name="eventType">
 5536    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5537    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5538    ''' </param>
 5539    ''' <param name="eventID">
 5540    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5541    ''' or filtering related log entries.
 5542    ''' </param>
 5543    ''' <param name="category">
 5544    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 5545    ''' Use 0 if no category is needed.
 5546    ''' </param>
 5547    ''' <param name="EntrySeverity">
 5548    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5549    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5550    ''' will be skipped and not written to the Event Log.
 5551    ''' </param>
 5552    ''' <remarks>
 5553    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5554    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5555    ''' to intercept and test log output without writing to the system Event Log.
 5556    ''' </remarks>
 5557    <Extension>
 545558    Public Sub LogEntry(
 545559            ByVal eventLog As EventLog,
 545560            ByVal message As String,
 545561            ByVal eventType As EventLogEntryType,
 545562            ByVal eventID As Integer,
 545563            ByVal category As Short,
 545564            ByVal EntrySeverity As LoggingSeverity)
 5565
 1085566        LogEntry(eventLog,
 1085567                 message,
 1085568                 eventType,
 1085569                 eventID,
 1085570                 category,
 1085571                 Nothing,
 1085572                 EntrySeverity)
 5573
 1085574    End Sub
 5575
 5576    ''' <summary>
 5577    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5578    ''' </summary>
 5579    ''' <param name="eventLog">
 5580    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5581    ''' with a valid log name and source.
 5582    ''' </param>
 5583    ''' <param name="message">
 5584    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5585    '''
 5586    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5587    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5588    '''
 5589    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5590    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5591    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5592    ''' </param>
 5593    ''' <param name="rawData">
 5594    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 5595    ''' </param>
 5596    ''' <remarks>
 5597    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5598    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5599    ''' to intercept and test log output without writing to the system Event Log.
 5600    ''' </remarks>
 5601    <Extension>
 185602    Public Sub LogEntry(
 185603            ByVal eventLog As EventLog,
 185604            ByVal message As String,
 185605            ByVal rawData As Byte())
 5606
 365607        LogEntry(eventLog,
 365608                 message,
 365609                 EventLogEntryType.Information,
 365610                 rawData)
 5611
 365612    End Sub
 5613
 5614    ''' <summary>
 5615    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5616    ''' </summary>
 5617    ''' <param name="eventLog">
 5618    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5619    ''' with a valid log name and source.
 5620    ''' </param>
 5621    ''' <param name="message">
 5622    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5623    '''
 5624    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5625    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5626    '''
 5627    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5628    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5629    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5630    ''' </param>
 5631    ''' <param name="rawData">
 5632    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 5633    ''' </param>
 5634    ''' <param name="EntrySeverity">
 5635    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5636    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5637    ''' will be skipped and not written to the Event Log.
 5638    ''' </param>
 5639    ''' <remarks>
 5640    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5641    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5642    ''' to intercept and test log output without writing to the system Event Log.
 5643    ''' </remarks>
 5644    <Extension>
 65645    Public Sub LogEntry(
 65646            ByVal eventLog As EventLog,
 65647            ByVal message As String,
 65648            ByVal rawData As Byte(),
 65649            ByVal EntrySeverity As LoggingSeverity)
 5650
 125651        LogEntry(eventLog,
 125652                 message,
 125653                 EventLogEntryType.Information,
 125654                 rawData,
 125655                 EntrySeverity)
 5656
 125657    End Sub
 5658
 5659    ''' <summary>
 5660    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5661    ''' </summary>
 5662    ''' <param name="eventLog">
 5663    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5664    ''' with a valid log name and source.
 5665    ''' </param>
 5666    ''' <param name="message">
 5667    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5668    '''
 5669    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5670    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5671    '''
 5672    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5673    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5674    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5675    ''' </param>
 5676    ''' <param name="eventType">
 5677    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5678    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5679    ''' </param>
 5680    ''' <param name="rawData">
 5681    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 5682    ''' </param>
 5683    ''' <remarks>
 5684    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5685    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5686    ''' to intercept and test log output without writing to the system Event Log.
 5687    ''' </remarks>
 5688    <Extension>
 185689    Public Sub LogEntry(
 185690            ByVal eventLog As EventLog,
 185691            ByVal message As String,
 185692            ByVal eventType As EventLogEntryType,
 185693            ByVal rawData As Byte())
 5694
 365695        LogEntry(eventLog,
 365696                 message,
 365697                 eventType,
 365698                 0,
 365699                 rawData)
 5700
 365701    End Sub
 5702
 5703    ''' <summary>
 5704    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5705    ''' </summary>
 5706    ''' <param name="eventLog">
 5707    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5708    ''' with a valid log name and source.
 5709    ''' </param>
 5710    ''' <param name="message">
 5711    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5712    '''
 5713    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5714    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5715    '''
 5716    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5717    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5718    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5719    ''' </param>
 5720    ''' <param name="eventType">
 5721    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5722    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5723    ''' </param>
 5724    ''' <param name="rawData">
 5725    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 5726    ''' </param>
 5727    ''' <param name="EntrySeverity">
 5728    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5729    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5730    ''' will be skipped and not written to the Event Log.
 5731    ''' </param>
 5732    ''' <remarks>
 5733    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5734    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5735    ''' to intercept and test log output without writing to the system Event Log.
 5736    ''' </remarks>
 5737    <Extension>
 65738    Public Sub LogEntry(
 65739            ByVal eventLog As EventLog,
 65740            ByVal message As String,
 65741            ByVal eventType As EventLogEntryType,
 65742            ByVal rawData As Byte(),
 65743            ByVal EntrySeverity As LoggingSeverity)
 5744
 125745        LogEntry(eventLog,
 125746                 message,
 125747                 eventType,
 125748                 0,
 125749                 rawData,
 125750                 EntrySeverity)
 5751
 125752    End Sub
 5753
 5754    ''' <summary>
 5755    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5756    ''' </summary>
 5757    ''' <param name="eventLog">
 5758    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5759    ''' with a valid log name and source.
 5760    ''' </param>
 5761    ''' <param name="message">
 5762    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5763    '''
 5764    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5765    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5766    '''
 5767    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5768    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5769    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5770    ''' </param>
 5771    ''' <param name="eventType">
 5772    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5773    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5774    ''' </param>
 5775    ''' <param name="eventID">
 5776    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5777    ''' or filtering related log entries.
 5778    ''' </param>
 5779    ''' <param name="rawData">
 5780    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 5781    ''' </param>
 5782    ''' <remarks>
 5783    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5784    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5785    ''' to intercept and test log output without writing to the system Event Log.
 5786    ''' </remarks>
 5787    <Extension>
 185788    Public Sub LogEntry(
 185789            ByVal eventLog As EventLog,
 185790            ByVal message As String,
 185791            ByVal eventType As EventLogEntryType,
 185792            ByVal eventID As Integer,
 185793            ByVal rawData As Byte())
 5794
 365795        LogEntry(eventLog,
 365796                 message,
 365797                 eventType,
 365798                 eventID,
 365799                 0,
 365800                 rawData)
 5801
 365802    End Sub
 5803
 5804    ''' <summary>
 5805    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5806    ''' </summary>
 5807    ''' <param name="eventLog">
 5808    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5809    ''' with a valid log name and source.
 5810    ''' </param>
 5811    ''' <param name="message">
 5812    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5813    '''
 5814    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5815    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5816    '''
 5817    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5818    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5819    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5820    ''' </param>
 5821    ''' <param name="eventType">
 5822    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5823    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5824    ''' </param>
 5825    ''' <param name="eventID">
 5826    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5827    ''' or filtering related log entries.
 5828    ''' </param>
 5829    ''' <param name="rawData">
 5830    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 5831    ''' </param>
 5832    ''' <param name="EntrySeverity">
 5833    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5834    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5835    ''' will be skipped and not written to the Event Log.
 5836    ''' </param>
 5837    ''' <remarks>
 5838    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5839    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5840    ''' to intercept and test log output without writing to the system Event Log.
 5841    ''' </remarks>
 5842    <Extension>
 65843    Public Sub LogEntry(
 65844            ByVal eventLog As EventLog,
 65845            ByVal message As String,
 65846            ByVal eventType As EventLogEntryType,
 65847            ByVal eventID As Integer,
 65848            ByVal rawData As Byte(),
 65849            ByVal EntrySeverity As LoggingSeverity)
 5850
 125851        LogEntry(eventLog,
 125852                 message,
 125853                 eventType,
 125854                 eventID,
 125855                 0,
 125856                 rawData,
 125857                 EntrySeverity)
 5858
 125859    End Sub
 5860
 5861    ''' <summary>
 5862    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5863    ''' </summary>
 5864    ''' <param name="eventLog">
 5865    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5866    ''' with a valid log name and source.
 5867    ''' </param>
 5868    ''' <param name="message">
 5869    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5870    '''
 5871    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5872    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5873    '''
 5874    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5875    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5876    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5877    ''' </param>
 5878    ''' <param name="eventType">
 5879    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5880    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5881    ''' </param>
 5882    ''' <param name="eventID">
 5883    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5884    ''' or filtering related log entries.
 5885    ''' </param>
 5886    ''' <param name="category">
 5887    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 5888    ''' Use 0 if no category is needed.
 5889    ''' </param>
 5890    ''' <param name="rawData">
 5891    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 5892    ''' </param>
 5893    ''' <remarks>
 5894    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5895    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5896    ''' to intercept and test log output without writing to the system Event Log.
 5897    ''' </remarks>
 5898    <Extension>
 305899    Public Sub LogEntry(
 305900            ByVal eventLog As EventLog,
 305901            ByVal message As String,
 305902            ByVal eventType As EventLogEntryType,
 305903            ByVal eventID As Integer,
 305904            ByVal category As Short,
 305905            ByVal rawData As Byte())
 5906
 605907        Initialize()
 605908        LogEntry(eventLog,
 605909                 message,
 605910                 eventType,
 605911                 eventID,
 605912                 category,
 605913                 rawData,
 605914                 LoggingSeverity)
 5915
 605916    End Sub
 5917
 5918    ''' <summary>
 5919    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 5920    ''' </summary>
 5921    ''' <param name="eventLog">
 5922    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 5923    ''' with a valid log name and source.
 5924    ''' </param>
 5925    ''' <param name="message">
 5926    ''' The message to log. If <c>null</c> or empty, a default message is used.
 5927    '''
 5928    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 5929    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 5930    '''
 5931    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 5932    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 5933    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 5934    ''' </param>
 5935    ''' <param name="eventType">
 5936    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 5937    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 5938    ''' </param>
 5939    ''' <param name="eventID">
 5940    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 5941    ''' or filtering related log entries.
 5942    ''' </param>
 5943    ''' <param name="category">
 5944    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 5945    ''' Use 0 if no category is needed.
 5946    ''' </param>
 5947    ''' <param name="rawData">
 5948    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 5949    ''' </param>
 5950    ''' <param name="EntrySeverity">
 5951    ''' Indicates the importance or severity of this log entry relative to the configured logging threshold
 5952    ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry
 5953    ''' will be skipped and not written to the Event Log.
 5954    ''' </param>
 5955    ''' <remarks>
 5956    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 5957    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 5958    ''' to intercept and test log output without writing to the system Event Log.
 5959    ''' </remarks>
 5960    <Extension>
 905961    Public Sub LogEntry(
 905962            ByVal eventLog As EventLog,
 905963            ByVal message As String,
 905964            ByVal eventType As EventLogEntryType,
 905965            ByVal eventID As Integer,
 905966            ByVal category As Short,
 905967            ByVal rawData As Byte(),
 905968            ByVal EntrySeverity As LoggingSeverity)
 5969
 1805970        Initialize() ' By the time we get here, this should already be done, but just in case.
 5971
 1865972        If EntrySeverity < CurrentLoggingLevel Then Exit Sub
 5973
 1685974        Dim defaultSource As String = Source(eventLog.Source)
 1685975        Dim finalEventType As EventLogEntryType = NormalizeEventType(eventType)
 5976
 1685977        If AllowMultiEntryMessages AndAlso message.Length > 32766 Then
 245978            For Each chunk As String In SplitMessageIntoPages(defaultSource, message)
 485979                _writer.WriteEntry(eventLog,
 485980                           chunk,
 485981                           finalEventType,
 485982                           eventID,
 485983                           category,
 485984                           rawData)
 245985            Next
 725986        Else
 1445987            _writer.WriteEntry(eventLog,
 1445988                               NormalizeMessage(eventLog.Source, message),
 1445989                               NormalizeEventType(eventType),
 1445990                               eventID,
 1445991                               category,
 1445992                               rawData)
 845993        End If
 5994
 1805995    End Sub
 5996
 5997#End Region
 5998
 5999#Region " Support Functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 6000
 6001    ''' <summary>
 6002    ''' Returns a default event source name. If none is provided, this attempts to determine the calling
 6003    ''' method's fully qualified name as the source.
 6004    ''' </summary>
 6005    ''' <param name="eventSourceName">Optional. A specific source name to use. If null or empty, the calling method will
 6006    ''' <returns>A valid event source name derived from the input or calling method.</returns>
 7206007    Public Function Source(
 7206008            Optional ByVal eventSourceName As String = Nothing) As String
 6009
 6010        ' Final fallback if nothing else is available
 14406011        Dim strReturn As String = "SmartEventLogger"
 6012
 14406013        If String.IsNullOrEmpty(eventSourceName) Then
 4086014            If Not String.IsNullOrEmpty(SourceName) Then
 126015                strReturn = SourceName
 1986016            Else
 6017                ' Try to get the calling assembly (e.g., the one calling your library)
 3966018                Dim thisAssembly As Assembly = Assembly.GetExecutingAssembly()
 6019
 3966020                Dim stackTrace As New StackTrace()
 3966021                For i As Integer = 1 To stackTrace.FrameCount - 1
 30846022                    Dim frame As StackFrame = stackTrace.GetFrame(i)
 30846023                    Dim method As MethodBase = frame.GetMethod()
 30846024                    Dim type As Type = method.DeclaringType
 30846025                    If type.Assembly IsNot thisAssembly Then
 3966026                        strReturn = $"{type.FullName}.{method.Name}"
 3966027                        Exit For
 13446028                    End If
 26886029                Next
 2106030            End If
 5166031        Else
 10326032            strReturn = eventSourceName.Trim()
 7206033        End If
 6034
 6035        ' Ensure the source name does not exceed the maximum length allowed by the Windows Event Log system
 14406036        Return MaxSource(strReturn)
 6037
 14406038    End Function
 6039
 6040    ''' <summary>
 6041    ''' Attempts to determine a default source name for the given event log by inspecting the registry.
 6042    ''' </summary>
 6043    ''' <param name="log">The name of the event log (e.g., "Application", "System").</param>
 6044    ''' <returns>The name of a registered event source, or an empty string if none are found.</returns>
 66045    Public Function DefaultSource(
 66046            ByVal log As String) As String
 6047
 126048        Initialize()
 6049
 126050        Return DefaultSource(log, MachineName)
 6051
 126052    End Function
 6053
 6054    ''' <summary>
 6055    ''' Attempts to determine a default source name for the given event log by inspecting the registry.
 6056    ''' </summary>
 6057    ''' <param name="logName">The name of the event log (e.g., "Application", "System").</param>
 6058    ''' <param name="machineName">The target machine name, or "." for the local machine.</param>
 6059    ''' <returns>The name of a registered event source, or an empty string if none are found.</returns>
 66060    Public Function DefaultSource(
 66061            ByVal logName As String,
 66062            ByVal machineName As String) As String
 6063
 126064        Return _registryReader.GetDefaultEventLogSource(logName, machineName)
 6065
 126066    End Function
 6067
 6068    ''' <summary>
 6069    ''' Truncates the source name to meet the maximum length allowed by the Windows Event Log system.
 6070    ''' </summary>
 6071    ''' <param name="sourceName">The original source name.</param>
 6072    ''' <returns>A source name no longer than 211 characters.</returns>
 6073    ''' <remarks>
 6074    ''' If the input is null or empty, the method will derive a source name using the calling method.
 6075    ''' </remarks>
 8286076    Public Function MaxSource(
 8286077        ByVal sourceName As String) As String
 6078
 16566079        If String.IsNullOrEmpty(sourceName) Then
 246080            sourceName = Source()
 8406081        End If
 6082
 16566083        Return sourceName.Substring(0, If(sourceName.Length > 211, 211, sourceName.Length))
 6084
 16566085    End Function
 6086
 6087    ''' <summary>
 6088    ''' Checks whether a specific source is registered to a specific event log on the specified machine.
 6089    ''' </summary>
 6090    ''' <param name="sourceName">The name of the event source.</param>
 6091    ''' <param name="logName">The name of the event log (e.g., "Application").</param>
 6092    ''' <param name="machineName">The target machine name, or "." for the local machine.</param>
 6093    ''' <returns><c>True</c> if the source is registered; otherwise, <c>False</c>.</returns>
 66094    Public Function IsSourceRegisteredToLog(
 66095            ByVal sourceName As String,
 66096            ByVal logName As String,
 66097            ByVal machineName As String) As Boolean
 6098
 126099        Dim registryPath As String = $"SYSTEM\CurrentControlSet\Services\EventLog\{logName}\{sourceName}"
 6100
 126101        Return _registryReader.SubKeyExists(RegistryHive.LocalMachine, machineName, registryPath)
 6102
 126103    End Function
 6104
 6105    ''' <summary>
 6106    ''' Checks if the current user has read access to the registry key for a specific event log source.
 6107    ''' </summary>
 6108    ''' <param name="sourceName">The name of the event source.</param>
 6109    ''' <param name="logName">The name of the event log.</param>
 6110    ''' <param name="machineName">The machine to check, or "." for local machine.</param>
 6111    ''' <returns><c>True</c> if the registry key can be read; otherwise, <c>False</c>.</returns>
 66112    Public Function CanReadRegistryForLogAndSource(
 66113            ByVal sourceName As String,
 66114            ByVal logName As String,
 66115            ByVal machineName As String) As Boolean
 6116
 126117        Dim registryPath As String = $"SYSTEM\CurrentControlSet\Services\EventLog\{logName}\{sourceName}"
 6118
 126119        Return _registryReader.HasRegistryAccess(RegistryHive.LocalMachine, machineName, registryPath, False)
 6120
 126121    End Function
 6122
 6123    ''' <summary>
 6124    ''' Determines if the current user has access (read or write) to the registry key for a given event log.
 6125    ''' </summary>
 6126    ''' <param name="logName">The name of the event log.</param>
 6127    ''' <param name="machineName">The target machine name, or "." for local machine.</param>
 6128    ''' <param name="writeAccess">Optional. <c>True</c> to check for write access; otherwise, <c>False</c> for read-only
 6129    ''' <returns><c>True</c> if access is permitted; otherwise, <c>False</c>.</returns>
 66130    Public Function CanReadRegistryForLog(
 66131            ByVal logName As String,
 66132            ByVal machineName As String,
 66133            Optional ByVal writeAccess As Boolean = False) As Boolean
 6134
 126135        Dim registryPath As String = $"SYSTEM\CurrentControlSet\Services\EventLog\{logName}"
 6136
 126137        Return _registryReader.HasRegistryAccess(RegistryHive.LocalMachine, machineName, registryPath, writeAccess)
 6138
 126139    End Function
 6140
 6141    ''' <summary>
 6142    ''' Normalizes the message.
 6143    ''' </summary>
 6144    ''' <param name="sourceName">Name of the source.</param>
 6145    ''' <param name="message">The message.</param>
 6146    ''' <returns></returns>
 3186147    Private Function NormalizeMessage(
 3186148            ByVal sourceName As String,
 3186149            ByVal message As String) As String
 6150
 6366151        Dim defaultSource As String = Source(sourceName)
 6366152        Dim finalMessage As String = If(String.IsNullOrEmpty(message), "No message provided.", message.Trim())
 11886153        If Not finalMessage.EndsWith("."c, StringComparison.CurrentCultureIgnoreCase) Then finalMessage &= "."
 12606154        If _IncludeSourceInMessage AndAlso Not finalMessage.StartsWith("["c, StringComparison.CurrentCultureIgnoreCase) 
 6155
 6156        Const maxLength As Integer = 32766
 6157        Const _truncationMarker As String = "... [TRUNCATED]"
 6366158        Dim marker As String = If(String.IsNullOrEmpty(TruncationMarker), _truncationMarker, TruncationMarker)
 6159
 6366160        If finalMessage.Length > maxLength Then
 6161            ' Leave room for the truncation marker
 1566162            Dim maxWithoutMarker As Integer = maxLength - marker.Length
 1566163            finalMessage = $"{finalMessage.Substring(0, maxWithoutMarker)}{marker}"
 3966164        End If
 6165
 6366166        Return finalMessage
 6167
 6366168    End Function
 6169
 6170    ''' <summary>
 6171    ''' Splits the message into pages.
 6172    ''' </summary>
 6173    ''' <param name="sourceName">Name of the source.</param>
 6174    ''' <param name="message">The message.</param>
 6175    ''' <returns></returns>
 186176    Private Function SplitMessageIntoPages(
 186177        ByVal sourceName As String,
 186178        ByVal message As String) As IEnumerable(Of String)
 6179
 6180        Const maxLength As Integer = 32766
 366181        Dim defaultSource As String = Source(sourceName)
 366182        Dim baseMessage As String = message.Trim()
 726183        If Not baseMessage.EndsWith("."c, StringComparison.CurrentCultureIgnoreCase) Then baseMessage &= "."
 6184
 366185        Dim cm As String = ContinuationMarker
 6186
 486187        If String.IsNullOrEmpty(cm) Then cm = " ..."
 6188
 6189        ' Initial prefix length calculation
 6190        ' Format: "[Source] [Part 999/999] "
 366191        Dim maxPartsEstimate As Integer = CInt(Math.Ceiling(baseMessage.Length / (maxLength - 50)))
 366192        Dim digitCount As Integer = maxPartsEstimate.ToString(CultureInfo.InvariantCulture).Length + 1 ' pad by 1 digit 
 6193
 6194        ' Build conservative prefix sample with max digit placeholders
 366195        Dim maxPartsPlaceholder As New String("9"c, digitCount)
 6196        Dim prefixSample As String
 366197        If _IncludeSourceInMessage Then
 246198            prefixSample = $"[{defaultSource}] [Part {maxPartsPlaceholder}/{maxPartsPlaceholder}] "
 66199        Else
 126200            prefixSample = $"[Part {maxPartsPlaceholder}/{maxPartsPlaceholder}] "
 306201        End If
 6202        ' Calculate the chunk size by subtracting the prefix length and the space for " ..." at the end of a chunk
 366203        Dim chunkSize As Integer = maxLength - prefixSample.Length - cm.Length
 6204
 6205        ' Now split message
 366206        Dim parts As New List(Of String)
 366207        Dim index As Integer = 0
 1086208        While index < baseMessage.Length
 726209            Dim len As Integer = Math.Min(chunkSize, baseMessage.Length - index)
 726210            parts.Add(baseMessage.Substring(index, len))
 726211            index += len
 366212        End While
 6213
 6214        ' Now wrap each chunk with prefix
 366215        Dim total As Integer = parts.Count
 366216        Dim result As New List(Of String)
 366217        For i As Integer = 0 To total - 2
 366218            If IncludeSourceInMessage Then
 246219                result.Add($"[{defaultSource}] [Part {i + 1}/{total}] {parts(i)}{cm}")
 66220            Else
 126221                result.Add($"[Part {i + 1}/{total}] {parts(i)}{cm}")
 306222            End If
 366223        Next
 366224        If IncludeSourceInMessage Then
 246225            result.Add($"[{defaultSource}] [Part {total}/{total}] {parts(total - 1)}")
 66226        Else
 126227            result.Add($"[Part {total}/{total}] {parts(total - 1)}")
 306228        End If
 6229
 366230        Return result
 6231
 366232    End Function
 6233
 6234    ''' <summary>
 6235    ''' Normalizes the type of the event.
 6236    ''' </summary>
 6237    ''' <param name="eventType">Type of the event.</param>
 6238    ''' <returns></returns>
 4086239    Private Function NormalizeEventType(
 4086240            ByVal eventType As EventLogEntryType) As EventLogEntryType
 6241
 8166242        Select Case eventType
 3426243            Case EventLogEntryType.Error, EventLogEntryType.Warning, EventLogEntryType.Information
 6846244                Return eventType
 666245            Case Else
 1326246                Return EventLogEntryType.Information
 6247        End Select
 6248
 8166249    End Function
 6250
 6251    ''' <summary>
 6252    ''' Normalizes the name of the machine.
 6253    ''' </summary>
 6254    ''' <param name="_machineName">Name of the machine.</param>
 6255    ''' <returns></returns>
 3486256    Private Function NormalizeMachineName(
 3486257            ByVal _machineName As String) As String
 6258
 6966259        Return If(String.IsNullOrEmpty(_machineName), If(String.IsNullOrEmpty(MachineName), ".", MachineName), _machineN
 6260
 3606261    End Function
 6262
 6263#If NETFRAMEWORK Then
 6264    ''' <summary>
 6265    ''' Reads an application setting by key, returning <paramref name="defaultValue"/>
 6266    ''' when no setting is found or an error occurs.
 6267    ''' </summary>
 6268    ''' <param name="key">The configuration key to retrieve.</param>
 6269    ''' <param name="defaultValue">The fallback value if the key is missing or empty.</param>
 6270    ''' <remarks>
 6271    ''' <para>
 6272    ''' <b>.NET Framework:</b> Reads from <c>App.config</c> / <c>Web.config</c> using
 6273    ''' <see cref="ConfigurationManager.AppSettings"/>.
 6274    ''' </para>
 6275    ''' <para>
 6276    ''' If the key is not present or the value is empty, <paramref name="defaultValue"/> is returned.
 6277    ''' </para>
 6278    ''' </remarks>
 6279    ''' <returns>The resolved configuration value or the provided default.</returns>
 6280    Friend Function GetAppSetting(
 6281            ByVal key As String,
 6282            ByVal defaultValue As String) As String
 6283
 6284        Dim value As String = String.Empty
 6285        Try
 6286            ' .NET Framework: App.config / Web.config
 6287            value = ConfigurationManager.AppSettings(key)
 6288        Catch ex As Exception
 6289            value = defaultValue
 6290        End Try
 6291
 6292        If String.IsNullOrEmpty(value) Then
 6293            value = defaultValue
 6294        End If
 6295
 6296        Return value
 6297
 6298    End Function
 6299#Else
 6300    ''' <summary>
 6301    ''' Reads an application setting by key, returning <paramref name="defaultValue"/>
 6302    ''' when no setting is found or an error occurs.
 6303    ''' </summary>
 6304    ''' <param name="key">The configuration key to retrieve.</param>
 6305    ''' <param name="defaultValue">The fallback value if the key is missing or empty.</param>
 6306    ''' <remarks>
 6307    ''' <para>
 6308    ''' <b>.NET Core / .NET 5+:</b> If <c>appsettings.json</c> exists in <c>AppContext.BaseDirectory</c>,
 6309    ''' reads exclusively from it via <see cref="ConfigurationBuilder"/>.
 6310    ''' If the file does not exist, falls back to <c>App.config</c> / <c>Web.config</c> using
 6311    ''' <see cref="System.Configuration.ConfigurationManager.AppSettings"/>.
 6312    ''' </para>
 6313    ''' <para>
 6314    ''' If the key is not present or the value is empty, <paramref name="defaultValue"/> is returned.
 6315    ''' </para>
 6316    ''' </remarks>
 6317    ''' <returns>The resolved configuration value or the provided default.</returns>
 49566318    Friend Function GetAppSetting(
 49566319            ByVal key As String,
 49566320            ByVal defaultValue As String) As String
 6321
 99126322        Dim value As String = String.Empty
 6323        ' .NET Core / .NET 5+
 6324        '       If appsettings.json exists, ONLY use it (ignore App.config/Web.config completely).
 6325        '       If appsettings.json does not exist, fall back to App.config/Web.config.
 6326        '       Missing or empty keys in either case fall back to defaultValue.
 99126327        Dim jsonPath As String = Path.Combine(AppContext.BaseDirectory, JsonSettingsFile)
 99126328        If FileSystem.FileExists(jsonPath) Then
 49446329            Try
 98886330                Dim builder As New ConfigurationBuilder()
 98886331                builder.SetBasePath(AppContext.BaseDirectory)
 98886332                builder.AddJsonFile(JsonSettingsFile, optional:=True, reloadOnChange:=True)
 98886333                Dim cr As IConfigurationRoot = builder.Build()
 6334
 98766335                value = cr(key)
 66336            Catch ex As Exception
 126337                value = defaultValue
 49446338            End Try
 126339        Else
 126340            Try
 6341                ' App.config / Web.config
 246342                value = Config.GetAppSetting(key)
 66343            Catch ex As Exception
 126344                value = defaultValue
 126345            End Try
 49566346        End If
 6347
 99126348        If String.IsNullOrEmpty(value) Then
 60726349            value = defaultValue
 79926350        End If
 6351
 99126352        Return value
 6353
 99126354    End Function
 6355#End If
 6356
 6357    ''' <summary>
 6358    ''' Gets the application setting.
 6359    ''' </summary>
 6360    ''' <param name="key">The key.</param>
 6361    ''' <param name="defaultValue">The default value.</param>
 6362    ''' <returns></returns>
 7566363    Private Function GetAppSetting(
 7566364            ByVal key As String,
 7566365            ByVal defaultValue As Integer) As Integer
 6366
 15126367        Dim raw As String = GetAppSetting(key, defaultValue.ToString(CultureInfo.InvariantCulture))
 6368
 6369        Dim result As Integer
 15126370        Return If(Integer.TryParse(raw, result), result, defaultValue)
 6371
 11346372    End Function
 6373
 6374    ''' <summary>
 6375    ''' Gets the application setting.
 6376    ''' </summary>
 6377    ''' <param name="key">The key.</param>
 6378    ''' <param name="defaultValue">if set to <c>true</c> default value.</param>
 6379    ''' <returns></returns>
 11346380    Private Function GetAppSetting(
 11346381            ByVal key As String,
 11346382            ByVal defaultValue As Boolean) As Boolean
 6383
 22686384        Dim raw As String = GetAppSetting(key, defaultValue.ToString())
 6385
 6386        Dim result As Boolean
 22686387        Return If(Boolean.TryParse(raw, result), result, defaultValue)
 6388
 18906389    End Function
 6390
 6391    ''' <summary>
 6392    ''' Gets the application setting.
 6393    ''' </summary>
 6394    ''' <typeparam name="TEnum">The type of the enum.</typeparam>
 6395    ''' <param name="key">The key.</param>
 6396    ''' <param name="defaultValue">The default value.</param>
 6397    ''' <returns></returns>
 6398    ''' <exception cref="ArgumentException">{NameOf(TEnum)} must be an Enum type.</exception>
 11586399    Friend Function GetAppSetting(Of TEnum As Structure)(
 11586400            ByVal key As String,
 11586401            ByVal defaultValue As TEnum) As TEnum
 6402
 6403        ' Make sure TEnum is actually an Enum
 23166404        If Not GetType(TEnum).IsEnum Then
 126405            Throw New ArgumentException($"{NameOf(TEnum)} must be an Enum type.")
 11526406        End If
 6407
 23046408        Dim rawValue As String = GetAppSetting(key, CType(Nothing, String))
 23046409        If String.IsNullOrEmpty(rawValue) Then
 22686410            Return defaultValue
 186411        End If
 6412
 186413        Try
 6414            ' Use Enum.Parse for .NET 3.5 compatibility
 6415#If NETFRAMEWORK Then
 6416            Dim parsedObj As Object = [Enum].Parse(GetType(TEnum), rawValue, True)
 6417#Else
 366418            Dim parsedObj As Object = [Enum].Parse(Of TEnum)(rawValue, True)
 6419#End If
 126420            Return CType(parsedObj, TEnum)
 66421        Catch ex As ArgumentException
 6422            ' Value not valid for the enum
 126423            Return defaultValue
 66424        Catch ex As OverflowException
 6425            ' In case of underlying type overflow
 126426            Return defaultValue
 6427        End Try
 6428
 23046429    End Function
 6430
 6431#End Region
 6432
 6433#Region " GetLog routines ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 6434
 6435    ''' <summary>
 6436    ''' Gets the entry log class to use for writing to the event log.
 6437    ''' </summary>
 6438    ''' <returns></returns>
 66439    Public Function GetLog() As EventLog
 6440
 126441        Initialize()
 6442
 126443        Return GetLog(
 126444            SourceName)
 6445
 126446    End Function
 6447
 6448    ''' <summary>
 6449    ''' Gets the entry log class to use for writing to the event log.
 6450    ''' </summary>
 6451    ''' <param name="sourceName">
 6452    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 6453    ''' generated using the calling method's namespace, class, and method name.
 6454    ''' If the source exceeds 254 characters, it is automatically truncated.
 6455    ''' </param>
 6456    ''' <returns></returns>
 66457    Public Function GetLog(
 66458            ByVal sourceName As String) As EventLog
 6459
 126460        Initialize()
 6461
 126462        Return GetLog(
 126463            LogName,
 126464            sourceName)
 6465
 126466    End Function
 6467
 6468    ''' <summary>
 6469    ''' Gets the entry log class to use for writing to the event log.
 6470    ''' </summary>
 6471    ''' <param name="logName">
 6472    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 6473    ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used.
 6474    ''' </param>
 6475    ''' <param name="sourceName">
 6476    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 6477    ''' generated using the calling method's namespace, class, and method name.
 6478    ''' If the source exceeds 254 characters, it is automatically truncated.
 6479    ''' </param>
 6480    ''' <returns></returns>
 966481    Public Function GetLog(
 966482            ByVal logName As String,
 966483            ByVal sourceName As String) As EventLog
 6484
 1926485        Initialize()
 6486
 1926487        Return GetLog(
 1926488            logName,
 1926489            sourceName,
 1926490            MaxKilobytes,
 1926491            RetentionDays)
 6492
 1926493    End Function
 6494
 6495    ''' <summary>
 6496    ''' Gets the entry log class to use for writing to the event log.
 6497    ''' </summary>
 6498    ''' <param name="logName">
 6499    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 6500    ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used.
 6501    ''' </param>
 6502    ''' <param name="sourceName">
 6503    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 6504    ''' generated using the calling method's namespace, class, and method name.
 6505    ''' If the source exceeds 254 characters, it is automatically truncated.
 6506    ''' </param>
 6507    ''' <param name="maxKilobytes">
 6508    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 6509    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 6510    ''' </param>
 6511    ''' <param name="retentionDays">
 6512    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 6513    ''' Only used when creating a new log.
 6514    ''' </param>
 6515    ''' <returns></returns>
 966516    Public Function GetLog(
 966517            ByVal logName As String,
 966518            ByVal sourceName As String,
 966519            ByVal maxKilobytes As Integer,
 966520            ByVal retentionDays As Integer) As EventLog
 6521
 1926522        Initialize()
 6523
 1926524        Return GetLog(
 1926525            logName,
 1926526            sourceName,
 1926527            maxKilobytes,
 1926528            retentionDays,
 1926529            WriteInitEntry)
 6530
 1926531    End Function
 6532
 6533    ''' <summary>
 6534    ''' Gets the entry log class to use for writing to the event log.
 6535    ''' </summary>
 6536    ''' <param name="logName">
 6537    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 6538    ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used.
 6539    ''' </param>
 6540    ''' <param name="sourceName">
 6541    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 6542    ''' generated using the calling method's namespace, class, and method name.
 6543    ''' If the source exceeds 254 characters, it is automatically truncated.
 6544    ''' </param>
 6545    ''' <param name="maxKilobytes">
 6546    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 6547    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 6548    ''' </param>
 6549    ''' <param name="retentionDays">
 6550    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 6551    ''' Only used when creating a new log.
 6552    ''' </param>
 6553    ''' <param name="writeInitEntry">
 6554    ''' Indicates whether an initialization entry should be written when a new log is created.
 6555    ''' </param>
 6556    ''' <returns></returns>
 966557    Public Function GetLog(
 966558            ByVal logName As String,
 966559            ByVal sourceName As String,
 966560            ByVal maxKilobytes As Integer,
 966561            ByVal retentionDays As Integer,
 966562            ByVal writeInitEntry As Boolean) As EventLog
 6563
 1926564        Initialize()
 6565
 1926566        Return GetLog(
 1926567            MachineName,
 1926568            logName,
 1926569            sourceName,
 1926570            maxKilobytes,
 1926571            retentionDays,
 1926572            writeInitEntry)
 6573
 1926574    End Function
 6575
 6576    ''' <summary>
 6577    ''' Gets the entry log class to use for writing to the event log.
 6578    ''' </summary>
 6579    ''' <param name="machineName">
 6580    ''' The name of the machine where the event log resides. Use <c>"."</c> to refer to the local machine.
 6581    ''' If <c>null</c> or empty, the local machine is used by default, or the value in <c>MachinName</c> if set.
 6582    ''' </param>
 6583    ''' <param name="logName">
 6584    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 6585    ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used.
 6586    ''' </param>
 6587    ''' <param name="sourceName">
 6588    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 6589    ''' generated using the calling method's namespace, class, and method name.
 6590    ''' If the source exceeds 254 characters, it is automatically truncated.
 6591    ''' </param>
 6592    ''' <param name="maxKilobytes">
 6593    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 6594    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 6595    ''' </param>
 6596    ''' <param name="retentionDays">
 6597    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 6598    ''' Only used when creating a new log.
 6599    ''' </param>
 6600    ''' <param name="writeInitEntry">
 6601    ''' Indicates whether an initialization entry should be written when a new log is created.
 6602    ''' </param>
 6603    ''' <returns></returns>
 966604    Public Function GetLog(
 966605            ByVal machineName As String,
 966606            ByVal logName As String,
 966607            ByVal sourceName As String,
 966608            ByVal maxKilobytes As Integer,
 966609            ByVal retentionDays As Integer,
 966610            ByVal writeInitEntry As Boolean) As EventLog
 6611
 1926612        Initialize()
 6613
 1926614        Return _writer.GetLog(
 1926615            NormalizeMachineName(machineName),
 1926616            logName,
 1926617            sourceName,
 1926618            maxKilobytes,
 1926619            retentionDays,
 1926620            writeInitEntry)
 6621
 1926622    End Function
 6623
 6624#End Region
 6625
 6626End Module

Methods/Properties

.cctor()
SetWriter(EventLogHelper.Interfaces.IEventLogWriter)
SetWriter(EventLogHelper.Interfaces.IEventLogWriter)
SetRegistryReader(EventLogHelper.Interfaces.IRegistryReader)
SetRegistryReader(EventLogHelper.Interfaces.IRegistryReader)
Initialize()
Initialize()
InitializeConfiguration()
InitializeConfiguration()
Reset()
Reset()
get_MachineName()
get_MachineName()
set_MachineName(System.String)
set_MachineName(System.String)
get_LogName()
get_LogName()
set_LogName(System.String)
set_LogName(System.String)
get_SourceName()
get_SourceName()
set_SourceName(System.String)
set_SourceName(System.String)
get_MaxKilobytes()
get_MaxKilobytes()
set_MaxKilobytes(System.Int32)
set_MaxKilobytes(System.Int32)
get_RetentionDays()
get_RetentionDays()
set_RetentionDays(System.Int32)
set_RetentionDays(System.Int32)
get_WriteInitEntry()
get_WriteInitEntry()
set_WriteInitEntry(System.Boolean)
set_WriteInitEntry(System.Boolean)
get_TruncationMarker()
get_TruncationMarker()
set_TruncationMarker(System.String)
set_TruncationMarker(System.String)
get_ContinuationMarker()
get_ContinuationMarker()
set_ContinuationMarker(System.String)
set_ContinuationMarker(System.String)
get_AllowMultiEntryMessages()
get_AllowMultiEntryMessages()
set_AllowMultiEntryMessages(System.Boolean)
set_AllowMultiEntryMessages(System.Boolean)
get_IsInitialized()
get_IsInitialized()
get_IncludeSourceInMessage()
get_IncludeSourceInMessage()
set_IncludeSourceInMessage(System.Boolean)
set_IncludeSourceInMessage(System.Boolean)
get_CurrentLoggingLevel()
get_CurrentLoggingLevel()
set_CurrentLoggingLevel(EventLogHelper.Enums.LoggingLevel)
set_CurrentLoggingLevel(EventLogHelper.Enums.LoggingLevel)
get_LoggingSeverity()
get_LoggingSeverity()
set_LoggingSeverity(EventLogHelper.Enums.LoggingSeverity)
set_LoggingSeverity(EventLogHelper.Enums.LoggingSeverity)
get_SourceResolutionBehavior()
get_SourceResolutionBehavior()
set_SourceResolutionBehavior(EventLogHelper.Enums.SourceResolutionBehavior)
set_SourceResolutionBehavior(EventLogHelper.Enums.SourceResolutionBehavior)
Log(System.String)
Log(System.String)
Log(System.String,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String)
Log(System.String,System.String)
Log(System.String,System.String,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType)
Log(System.String,System.Diagnostics.EventLogEntryType)
Log(System.String,System.Diagnostics.EventLogEntryType,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String)
Log(System.String,System.String,System.String)
Log(System.String,System.String,System.String,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Byte[])
Log(System.String,System.Byte[])
Log(System.String,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Byte[])
Log(System.String,System.Diagnostics.EventLogEntryType,System.Byte[])
Log(System.String,System.Diagnostics.EventLogEntryType,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Byte[])
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Byte[])
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Int32,System.Int32)
Log(System.String,System.Int32,System.Int32)
Log(System.String,System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Int32,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Int32,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
Log(System.String,System.String,System.String,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],System.Int32,System.Int32,System.Boolean,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String)
LogEntry(System.Diagnostics.EventLog,System.String)
LogEntry(System.Diagnostics.EventLog,System.String,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int32)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int32)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int32,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int32,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int16)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int16)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int16,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int16,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int16)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int16)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int16,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int16,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[],EventLogHelper.Enums.LoggingSeverity)
Source(System.String)
Source(System.String)
DefaultSource(System.String)
DefaultSource(System.String)
DefaultSource(System.String,System.String)
DefaultSource(System.String,System.String)
MaxSource(System.String)
MaxSource(System.String)
IsSourceRegisteredToLog(System.String,System.String,System.String)
IsSourceRegisteredToLog(System.String,System.String,System.String)
CanReadRegistryForLogAndSource(System.String,System.String,System.String)
CanReadRegistryForLogAndSource(System.String,System.String,System.String)
CanReadRegistryForLog(System.String,System.String,System.Boolean)
CanReadRegistryForLog(System.String,System.String,System.Boolean)
NormalizeMessage(System.String,System.String)
NormalizeMessage(System.String,System.String)
SplitMessageIntoPages(System.String,System.String)
SplitMessageIntoPages(System.String,System.String)
NormalizeEventType(System.Diagnostics.EventLogEntryType)
NormalizeEventType(System.Diagnostics.EventLogEntryType)
NormalizeMachineName(System.String)
NormalizeMachineName(System.String)
GetAppSetting(System.String,System.String)
GetAppSetting(System.String,System.String)
GetAppSetting(System.String,System.Int32)
GetAppSetting(System.String,System.Int32)
GetAppSetting(System.String,System.Boolean)
GetAppSetting(System.String,System.Boolean)
GetAppSetting(System.String,TEnum)
GetAppSetting(System.String,TEnum)
GetLog()
GetLog()
GetLog(System.String)
GetLog(System.String)
GetLog(System.String,System.String)
GetLog(System.String,System.String)
GetLog(System.String,System.String,System.Int32,System.Int32)
GetLog(System.String,System.String,System.Int32,System.Int32)
GetLog(System.String,System.String,System.Int32,System.Int32,System.Boolean)
GetLog(System.String,System.String,System.Int32,System.Int32,System.Boolean)
GetLog(System.String,System.String,System.String,System.Int32,System.Int32,System.Boolean)
GetLog(System.String,System.String,System.String,System.Int32,System.Int32,System.Boolean)