< Summary - EventLogHelper Code Coverage

Information
Class: EventLogHelper.SmartEventLogger
Assembly: EventLogHelper
File(s): c:\agent\_work\12\s\Code\EventLogHelper\EventLogHelper\SmartEventLogger.vb
Tag: EventLogHelper Build_2025.8.10.1_#549
Line coverage
100%
Covered lines: 1010
Uncovered lines: 0
Coverable lines: 1010
Total lines: 3560
Line coverage: 100%
Branch coverage
100%
Covered branches: 76
Total branches: 76
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

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%
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%
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%1212100%
Log(...)100%1212100%
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%66100%
LogEntry(...)100%66100%
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%1010100%
NormalizeMessage(...)100%1010100%
SplitMessageIntoPages(...)100%88100%
SplitMessageIntoPages(...)100%88100%
NormalizeEventType(...)100%44100%
NormalizeEventType(...)100%44100%
NormalizeMachineName(...)100%44100%
NormalizeMachineName(...)100%44100%
GetAppSetting(...)100%22100%
GetAppSetting(...)100%22100%
GetAppSetting(...)100%22100%
GetAppSetting(...)100%22100%
GetAppSetting(...)100%22100%
GetAppSetting(...)100%22100%
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\12\s\Code\EventLogHelper\EventLogHelper\SmartEventLogger.vb

#LineLine coverage
 1Imports Microsoft.Win32
 2Imports System.Reflection
 3Imports System.Runtime.CompilerServices
 4
 5#If NETFRAMEWORK Then
 6Imports System.Configuration
 7#Else
 8Imports Microsoft.Extensions.Configuration
 9#End If
 10
 11''' <summary>
 12''' Provides high-level utilities for logging to the Windows Event Log in a simplified and customizable way.
 13''' </summary><remarks>
 14''' <para>
 15''' This module abstracts common patterns for writing entries to the Windows Event Log. It simplifies usage by handling:
 16''' </para>
 17''' <list type="bullet">
 18'''   <item>Automatic validation and creation of logs and sources.</item>
 19'''   <item>Falls back when <c>log</c> or <c>source</c> parameters are not provided.</item>
 20'''   <item>Automatic source naming based on the calling method and class context.</item>
 21'''   <item>Safe handling and truncation of long messages to comply with system limits.</item>
 22''' </list>
 23''' <para>
 24''' The default event log is <c>Application</c>. If no source is provided, a fully qualified method name
 25''' (including namespace and class) is used as the source identifier.
 26''' </para>
 27''' <para>
 28''' This module is suitable for both production use (via <see cref="RealEventLogWriter" />) and unit testing
 29''' (via a test implementation such as <c>EventLogHelper.Tests.TestEventLogWriter</c> in a separate test project).
 30''' </para>
 31''' </remarks>
 32Public Module SmartEventLogger
 33
 34#Region " Process Support Objects ^^^^^^^^^^^^^^^^^^^^^^^^^ "
 35
 36    ''' <summary>
 37    ''' The current event log writer instance used by the logger.
 38    ''' </summary>
 39    ''' <remarks>
 40    ''' By default, this is initialized to an instance of <see cref="RealEventLogWriter"/>, which writes to the actual
 41    ''' Windows Event Log. This field is typically replaced during testing with a mock or stub implementation via the
 42    ''' <see cref="SetWriter"/> method.
 43    ''' </remarks>
 844    Private _writer As IEventLogWriter = New RealEventLogWriter()
 45    ''' <summary>
 46    ''' The registry reader
 47    ''' </summary>
 848    Private _registryReader As IRegistryReader = New RealRegistryReader()
 49
 50    ''' <summary>
 51    ''' Sets the <see cref="IEventLogWriter"/> implementation used for logging operations.
 52    ''' </summary>
 53    ''' <param name="writer">
 54    ''' The custom writer instance to use. This allows swapping out the default <see cref="RealEventLogWriter"/>
 55    ''' for testing or alternate logging implementations.
 56    ''' </param>
 57    ''' <remarks>
 58    ''' This method is primarily intended for use in unit tests or advanced scenarios where log output should be redirec
 59    ''' or suppressed. For example, a test implementation may capture and inspect log data without writing to the real e
 60    ''' </remarks>
 13261    Public Sub SetWriter(writer As IEventLogWriter)
 62
 26463        _writer = writer
 64
 26465    End Sub
 66
 67    ''' <summary>
 68    ''' Specifies the <see cref="IRegistryReader"/> implementation to use when accessing
 69    ''' the Windows Registry for log-related operations (e.g., determining default event log sources).
 70    ''' </summary>
 71    ''' <param name="reader">
 72    ''' The custom <see cref="IRegistryReader"/> instance to use. This is typically used for unit testing
 73    ''' or customizing how registry access is performed. If not set, the default implementation will be used.
 74    ''' </param>
 75    ''' <remarks>
 76    ''' This method allows injection of a mock or testable registry reader. In production,
 77    ''' a default <c>RealRegistryReader</c> is used, but in unit tests, you may inject a fake
 78    ''' reader to simulate different registry states without accessing the actual system registry.
 79    ''' </remarks>
 2480    Public Sub SetRegistryReader(reader As IRegistryReader)
 81
 4882        _registryReader = reader
 83
 4884    End Sub
 85
 86#End Region
 87
 88#Region " Initialization ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 89
 90    ''' <summary>
 91    ''' Has the Initialization process happened?
 92    ''' This is used to prevent multiple initializations.
 93    ''' </summary>
 894    Private _isInitialized As Boolean = False
 95
 96    ''' <summary>
 97    ''' is initializing
 98    ''' </summary>
 899    Private _isInitializing As Boolean = False
 100
 101    ''' <summary>
 102    ''' The initialization lock
 103    ''' </summary>
 8104    Private ReadOnly _initLock As New Object()
 105
 106    ''' <summary>
 107    ''' Initializes this instance.
 108    ''' </summary>
 1968109    Private Sub Initialize()
 110
 5892111        If _isInitialized OrElse _isInitializing Then Return
 24112        _isInitializing = True
 36113        SyncLock _initLock
 12114            Try
 24115                If Not _isInitialized Then
 24116                    MachineName = GetAppSetting("EventLogHelper.MachineName", MachineName)
 24117                    LogName = GetAppSetting("EventLogHelper.LogName", LogName)
 24118                    SourceName = GetAppSetting("EventLogHelper.SourceName", SourceName)
 24119                    MaxKilobytes = GetAppSetting("EventLogHelper.MaxKilobytes", MaxKilobytes)
 24120                    RetentionDays = GetAppSetting("EventLogHelper.RetentionDays", RetentionDays)
 24121                    WriteInitEntry = GetAppSetting("EventLogHelper.WriteInitEntry", WriteInitEntry)
 24122                    TruncationMarker = GetAppSetting("EventLogHelper.TruncationMarker", TruncationMarker)
 24123                    ContinuationMarker = GetAppSetting("EventLogHelper.ContinuationMarker", ContinuationMarker)
 24124                    AllowMultiEntryMessages = GetAppSetting("EventLogHelper.AllowMultiEntryMessages", AllowMultiEntryMes
 125
 24126                    _isInitialized = True
 36127                End If
 12128            Finally
 24129                _isInitializing = False
 12130            End Try
 36131        End SyncLock
 132
 3936133    End Sub
 134
 135    ''' <remarks>
 136    ''' <para>
 137    ''' This method reads predefined settings from the application's configuration and
 138    ''' applies them to the corresponding <see cref="SmartEventLogger"/> properties.
 139    ''' If a configuration value is not found, the property's existing value is retained.
 140    ''' </para>
 141    ''' <para>
 142    ''' Calling this method explicitly is optional. Configuration will also be loaded
 143    ''' automatically the first time a public method or property is accessed, unless it
 144    ''' has already been initialized.
 145    ''' </para>
 146    ''' <para>
 147    ''' Thread-safe: Initialization is guaranteed to run only once, even if called
 148    ''' concurrently from multiple threads.
 149    ''' </para>
 150    '''
 151    ''' <para>
 152    ''' Recognized configuration keys:
 153    ''' </para>
 154    ''' <list type="table">
 155    '''   <listheader>
 156    '''     <term>Key</term>
 157    '''     <description>Description</description>
 158    '''   </listheader>
 159    '''
 160    '''   <item>
 161    '''     <term>EventLogHelper.MachineName</term>
 162    '''     <description>
 163    ''' The name of the machine where the event log resides. Use <c>"."</c> for the local machine.
 164    ''' Defaults to the current value of <see cref="MachineName"/> (normally ".").
 165    ''' </description>
 166    '''   </item>
 167    '''
 168    '''   <item>
 169    '''     <term>EventLogHelper.LogName</term>
 170    '''     <description>
 171    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log).
 172    ''' Defaults to the current value of <see cref="LogName"/> (normally "Application").
 173    ''' </description>
 174    '''   </item>
 175    '''
 176    '''   <item>
 177    '''     <term>EventLogHelper.SourceName</term>
 178    '''     <description>
 179    ''' The event source name associated with log entries. If not provided, a name is automatically
 180    ''' generated from the calling method's namespace, class, and method name. Defaults to
 181    ''' the current value of <see cref="SourceName"/>.
 182    ''' </description>
 183    '''   </item>
 184    '''
 185    '''   <item>
 186    '''     <term>EventLogHelper.MaxKilobytes</term>
 187    '''     <description>
 188    ''' The maximum size of the event log in kilobytes when creating a new log.
 189    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 190    ''' Defaults to the current value of <see cref="MaxKilobytes"/> (normally 0).
 191    ''' </description>
 192    '''   </item>
 193    '''
 194    '''   <item>
 195    '''     <term>EventLogHelper.RetentionDays</term>
 196    '''     <description>
 197    ''' The number of days to retain event log entries when creating a new log.
 198    ''' If 0, events are retained indefinitely.
 199    ''' Defaults to the current value of <see cref="RetentionDays"/> (normally 0).
 200    ''' </description>
 201    '''   </item>
 202    '''
 203    '''   <item>
 204    '''     <term>EventLogHelper.WriteInitEntry</term>
 205    '''     <description>
 206    ''' Indicates whether to write an initialization entry to the log when a new log is created.
 207    ''' Defaults to the current value of <see cref="WriteInitEntry"/> (normally True).
 208    ''' </description>
 209    '''   </item>
 210    '''
 211    '''   <item>
 212    '''     <term>EventLogHelper.TruncationMarker</term>
 213    '''     <description>
 214    ''' The string appended to messages that are truncated due to exceeding the 32,766-character limit.
 215    ''' Defaults to the current value of <see cref="TruncationMarker"/> (normally "... [TRUNCATED]").
 216    ''' </description>
 217    '''   </item>
 218    '''
 219    '''   <item>
 220    '''     <term>EventLogHelper.ContinuationMarker</term>
 221    '''     <description>
 222    ''' The string appended to all but the last chunk of a message when multi-entry logging is enabled.
 223    ''' Defaults to the current value of <see cref="ContinuationMarker"/> (normally " ...").
 224    ''' </description>
 225    '''   </item>
 226    '''
 227    '''   <item>
 228    '''     <term>EventLogHelper.AllowMultiEntryMessages</term>
 229    '''     <description>
 230    ''' Indicates whether messages longer than 32,766 characters should be split into multiple
 231    ''' sequential entries instead of being truncated. Defaults to the current value of
 232    ''' <see cref="AllowMultiEntryMessages"/> (normally False).
 233    ''' </description>
 234    '''   </item>
 235    '''
 236    ''' </list>
 237    ''' </remarks>
 8238    Public Sub InitializeConfiguration()
 239
 16240        Initialize()
 241
 16242    End Sub
 243
 244#End Region
 245
 246#Region " Backing Fields ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 247
 248    ''' <summary>
 249    ''' The machine name
 250    ''' </summary>
 8251    Private _machineName As String = "."
 252    ''' <summary>
 253    ''' The log name
 254    ''' </summary>
 8255    Private _logName As String = "Application"
 256    ''' <summary>
 257    ''' The source name
 258    ''' </summary>
 8259    Private _sourceName As String = ""
 260    ''' <summary>
 261    ''' The maximum kilobytes
 262    ''' </summary>
 8263    Private _maxKilobytes As Integer = 1024 * 1024
 264    ''' <summary>
 265    ''' The retention days
 266    ''' </summary>
 8267    Private _retentionDays As Integer = 7
 268    ''' <summary>
 269    ''' The write initialize entry
 270    ''' </summary>
 8271    Private _writeInitEntry As Boolean = False
 272    ''' <summary>
 273    ''' The truncation marker
 274    ''' </summary>
 8275    Private _truncationMarker As String = "... [TRUNCATED]"
 276    ''' <summary>
 277    ''' The continuation marker
 278    ''' </summary>
 8279    Private _continuationMarker As String = " ..."
 280    ''' <summary>
 281    ''' The allow multi entry messages
 282    ''' </summary>
 8283    Private _allowMultiEntryMessages As Boolean = False
 284
 285#End Region
 286
 287#Region " Default Value Properties ^^^^^^^^^^^^^^^^^^^^^^^^ "
 288
 289    ''' <summary>
 290    ''' Gets or sets the name of the machine where log entries will be written.
 291    ''' </summary>
 292    ''' <value>
 293    ''' A string representing the machine name. Use <c>"."</c> for the local machine.
 294    ''' </value>
 295    Property MachineName As String
 296
 234297        Get
 298
 468299            Initialize()
 468300            Return _machineName
 301
 468302        End Get
 32303        Set
 304
 64305            Initialize()
 64306            _machineName = Value
 307
 64308        End Set
 309
 310    End Property
 311
 312    ''' <summary>
 313    ''' Gets or sets the name of the Windows Event Log to write to (e.g., "Application", "System").
 314    ''' </summary>
 315    ''' <value>
 316    ''' A string specifying the log name. Defaults to <c>"Application"</c>.
 317    ''' </value>
 318    Property LogName As String
 319
 112320        Get
 321
 224322            Initialize()
 224323            Return _logName
 324
 224325        End Get
 16326        Set
 327
 32328            Initialize()
 32329            _logName = Value
 330
 32331        End Set
 332
 333    End Property
 334
 335    ''' <summary>
 336    ''' Gets or sets the name of the event source associated with log entries.
 337    ''' </summary>
 338    ''' <value>
 339    ''' A string representing the source name. If not set, a source is inferred automatically using the calling method's
 340    ''' </value>
 341    Property SourceName As String
 342
 100343        Get
 344
 200345            Initialize()
 200346            Return _sourceName
 347
 200348        End Get
 28349        Set
 350
 56351            Initialize()
 56352            _sourceName = Value
 353
 56354        End Set
 355
 356    End Property
 357
 358    ''' <summary>
 359    ''' Gets or sets the maximum allowed size of the event log in kilobytes.
 360    ''' </summary>
 361    ''' <value>
 362    ''' An integer representing the size in kilobytes. Defaults to <c>1,048,576</c> (1 GB).
 363    ''' </value>
 364    ''' <remarks>
 365    ''' Applies only when creating or configuring new custom logs. May require administrative privileges.
 366    ''' </remarks>
 367    Property MaxKilobytes As Integer
 368
 136369        Get
 370
 272371            Initialize()
 272372            Return _maxKilobytes
 373
 272374        End Get
 16375        Set
 376
 32377            Initialize()
 32378            _maxKilobytes = Value
 379
 32380        End Set
 381
 382    End Property
 383
 384    ''' <summary>
 385    ''' Gets or sets the number of days event entries are retained before being overwritten.
 386    ''' </summary>
 387    ''' <value>
 388    ''' An integer representing the retention duration in days. Defaults to <c>7</c>.
 389    ''' </value>
 390    ''' <remarks>
 391    ''' Used when initializing a new event log. May be ignored depending on overflow policy or system restrictions.
 392    ''' </remarks>
 393    Property RetentionDays As Integer
 394
 140395        Get
 396
 280397            Initialize()
 280398            Return _retentionDays
 399
 280400        End Get
 16401        Set
 402
 32403            Initialize()
 32404            _retentionDays = Value
 405
 32406        End Set
 407
 408    End Property
 409
 410    ''' <summary>
 411    ''' Gets or sets a value indicating whether an informational entry should be written when a new log is created.
 412    ''' </summary>
 413    ''' <value>
 414    ''' <c>True</c> to log an initialization message; otherwise, <c>False</c>. Defaults to <c>False</c>.
 415    ''' </value>
 416    Property WriteInitEntry As Boolean
 417
 144418        Get
 419
 288420            Initialize()
 288421            Return _writeInitEntry
 422
 288423        End Get
 16424        Set
 425
 32426            Initialize()
 32427            _writeInitEntry = Value
 428
 32429        End Set
 430
 431    End Property
 432
 433    ''' <summary>
 434    ''' Gets or sets the marker text used when a message is too long and must be truncated.
 435    ''' </summary>
 436    ''' <value>
 437    ''' A string appended to truncated log entries. Defaults to <c>"... [TRUNCATED]"</c>.
 438    ''' </value>
 439    Property TruncationMarker As String
 440
 202441        Get
 442
 404443            Initialize()
 404444            Return _truncationMarker
 445
 404446        End Get
 16447        Set
 448
 32449            Initialize()
 32450            _truncationMarker = Value
 451
 32452        End Set
 453
 454    End Property
 455
 456    ''' <summary>
 457    ''' Gets or sets the continuation marker used when splitting long messages
 458    ''' across multiple event log entries.
 459    ''' </summary>
 460    ''' <value>
 461    ''' The string appended to each intermediate log entry when
 462    ''' <see cref="AllowMultiEntryMessages"/> is <c>true</c>.
 463    ''' Defaults to <c>" ..."</c>.
 464    ''' This value is ignored if message splitting is disabled.
 465    ''' </value>
 466    ''' <remarks>
 467    ''' The marker is added to all chunks except the final one to indicate the
 468    ''' message continues in the next log entry. Make sure the marker is short
 469    ''' enough to allow meaningful message content within the 32,766-character
 470    ''' limit of the Event Log.
 471    ''' </remarks>
 472    Property ContinuationMarker As String
 473
 20474        Get
 475
 40476            Initialize()
 40477            Return _continuationMarker
 478
 40479        End Get
 20480        Set
 481
 40482            Initialize()
 40483            _continuationMarker = Value
 484
 40485        End Set
 486
 487    End Property
 488
 489    ''' <summary>
 490    ''' Gets or sets a value indicating whether messages that exceed the Event Log
 491    ''' length limit should be split across multiple entries.
 492    ''' </summary>
 493    ''' <value>
 494    ''' <c>true</c> to split long messages into multiple event log entries;
 495    ''' <c>false</c> to truncate long messages and append a truncation notice.
 496    ''' Default is <c>false</c>.
 497    ''' </value>
 498    ''' <remarks>
 499    ''' When enabled, messages exceeding 32,766 characters are split into sequential entries,
 500    ''' each prefixed with a part number and optionally suffixed with a continuation marker
 501    ''' (see <see cref="ContinuationMarker"/>). This preserves the full message without truncation.
 502    '''
 503    ''' When disabled, long messages are truncated to fit within the Event Log limit,
 504    ''' and the truncation marker (e.g., <c>"... [TRUNCATED]"</c>) is appended.
 505    ''' </remarks>
 506    Property AllowMultiEntryMessages As Boolean
 507
 140508        Get
 509
 280510            Initialize()
 280511            Return _allowMultiEntryMessages
 512
 280513        End Get
 28514        Set
 515
 56516            Initialize()
 56517            _allowMultiEntryMessages = Value
 518
 56519        End Set
 520
 521    End Property
 522
 523    ''' <summary>
 524    ''' Gets a value indicating whether this instance is initialized.
 525    ''' </summary>
 526    ''' <value>
 527    '''   <c>true</c> if this instance is initialized; otherwise, <c>false</c>.
 528    ''' </value>
 529    Public ReadOnly Property IsInitialized As Boolean
 530
 4531        Get
 8532            Return _isInitialized
 533
 8534        End Get
 535
 536    End Property
 537
 538#End Region
 539
 540#Region " Log Methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 541
 542    ''' <summary>
 543    ''' Writes an entry to the Windows Event Log using the provided parameters.
 544    ''' </summary>
 545    ''' <param name="message">
 546    ''' The message to log. If <c>null</c> or empty, a default message is used.
 547    '''
 548    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 549    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 550    '''
 551    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 552    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 553    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 554    ''' </param>
 555    ''' <remarks>
 556    ''' <para>
 557    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 558    ''' </para>
 559    ''' <para>
 560    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 561    ''' </para>
 562    ''' </remarks>
 4563    Public Sub Log(
 4564            ByVal message As String)
 565
 8566        Log("",
 8567            "",
 8568            message)
 569
 8570    End Sub
 571
 572    ''' <summary>
 573    ''' Writes an entry to the Windows Event Log using the provided parameters.
 574    ''' </summary>
 575    ''' <param name="source">
 576    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 577    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 578    ''' </param>
 579    ''' <param name="message">
 580    ''' The message to log. If <c>null</c> or empty, a default message is used.
 581    '''
 582    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 583    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 584    '''
 585    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 586    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 587    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 588    ''' </param>
 589    ''' <remarks>
 590    ''' <para>
 591    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 592    ''' </para>
 593    ''' <para>
 594    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 595    ''' </para>
 596    ''' </remarks>
 4597    Public Sub Log(
 4598            ByVal source As String,
 4599            ByVal message As String)
 600
 8601        Log("",
 8602            source,
 8603            message)
 604
 8605    End Sub
 606
 607    ''' <summary>
 608    ''' Writes an entry to the Windows Event Log using the provided parameters.
 609    ''' </summary>
 610    ''' <param name="message">
 611    ''' The message to log. If <c>null</c> or empty, a default message is used.
 612    '''
 613    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 614    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 615    '''
 616    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 617    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 618    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 619    ''' </param>
 620    ''' <param name="eventType">
 621    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 622    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 623    ''' </param>
 624    ''' <remarks>
 625    ''' <para>
 626    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 627    ''' </para>
 628    ''' <para>
 629    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 630    ''' </para>
 631    ''' </remarks>
 4632    Public Sub Log(
 4633            ByVal message As String,
 4634            ByVal eventType As EventLogEntryType)
 635
 8636        Log("",
 8637            message,
 8638            eventType)
 639
 8640    End Sub
 641
 642    ''' <summary>
 643    ''' Writes an entry to the Windows Event Log using the provided parameters.
 644    ''' </summary>
 645    ''' <param name="logName">
 646    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 647    ''' If <c>null</c> or empty, "Application" is used by default.
 648    ''' </param>
 649    ''' <param name="sourceName">
 650    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 651    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 652    ''' </param>
 653    ''' <param name="message">
 654    ''' The message to log. If <c>null</c> or empty, a default message is used.
 655    '''
 656    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 657    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 658    '''
 659    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 660    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 661    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 662    ''' </param>
 663    ''' <remarks>
 664    ''' <para>
 665    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 666    ''' </para>
 667    ''' <para>
 668    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 669    ''' </para>
 670    ''' </remarks>
 12671    Public Sub Log(
 12672            ByVal logName As String,
 12673            ByVal sourceName As String,
 12674            ByVal message As String)
 675
 24676        Log(logName,
 24677            sourceName,
 24678            message,
 24679            EventLogEntryType.Information)
 680
 24681    End Sub
 682
 683    ''' <summary>
 684    ''' Writes an entry to the Windows Event Log using the provided parameters.
 685    ''' </summary>
 686    ''' <param name="sourceName">
 687    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 688    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 689    ''' </param>
 690    ''' <param name="message">
 691    ''' The message to log. If <c>null</c> or empty, a default message is used.
 692    '''
 693    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 694    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 695    '''
 696    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 697    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 698    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 699    ''' </param>
 700    ''' <param name="eventType">
 701    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 702    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 703    ''' </param>
 704    ''' <remarks>
 705    ''' <para>
 706    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 707    ''' </para>
 708    ''' <para>
 709    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 710    ''' </para>
 711    ''' </remarks>
 8712    Public Sub Log(
 8713            ByVal sourceName As String,
 8714            ByVal message As String,
 8715            ByVal eventType As EventLogEntryType)
 716
 16717        Log("",
 16718            sourceName,
 16719            message,
 16720            eventType)
 721
 16722    End Sub
 723
 724    ''' <summary>
 725    ''' Writes an entry to the Windows Event Log using the provided parameters.
 726    ''' </summary>
 727    ''' <param name="logName">
 728    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 729    ''' If <c>null</c> or empty, "Application" is used by default.
 730    ''' </param>
 731    ''' <param name="sourceName">
 732    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 733    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 734    ''' </param>
 735    ''' <param name="message">
 736    ''' The message to log. If <c>null</c> or empty, a default message is used.
 737    '''
 738    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 739    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 740    '''
 741    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 742    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 743    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 744    ''' </param>
 745    ''' <param name="eventType">
 746    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 747    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 748    ''' </param>
 749    ''' <remarks>
 750    ''' <para>
 751    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 752    ''' </para>
 753    ''' <para>
 754    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 755    ''' </para>
 756    ''' </remarks>
 24757    Public Sub Log(
 24758            ByVal logName As String,
 24759            ByVal sourceName As String,
 24760            ByVal message As String,
 24761            ByVal eventType As EventLogEntryType)
 762
 48763        Log(logName,
 48764            sourceName,
 48765            message,
 48766            eventType,
 48767            0)
 768
 48769    End Sub
 770
 771    ''' <summary>
 772    ''' Writes an entry to the Windows Event Log using the provided parameters.
 773    ''' </summary>
 774    ''' <param name="message">
 775    ''' The message to log. If <c>null</c> or empty, a default message is used.
 776    '''
 777    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 778    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 779    '''
 780    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 781    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 782    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 783    ''' </param>
 784    ''' <param name="eventType">
 785    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 786    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 787    ''' </param>
 788    ''' <param name="eventID">
 789    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 790    ''' </param>
 791    ''' <remarks>
 792    ''' <para>
 793    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 794    ''' </para>
 795    ''' <para>
 796    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 797    ''' </para>
 798    ''' </remarks>
 4799    Public Sub Log(
 4800            ByVal message As String,
 4801            ByVal eventType As EventLogEntryType,
 4802            ByVal eventID As Integer)
 803
 8804        Log("",
 8805            message,
 8806            eventType,
 8807            eventID)
 808
 8809    End Sub
 810
 811    ''' <summary>
 812    ''' Writes an entry to the Windows Event Log using the provided parameters.
 813    ''' </summary>
 814    ''' <param name="sourceName">
 815    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 816    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 817    ''' </param>
 818    ''' <param name="message">
 819    ''' The message to log. If <c>null</c> or empty, a default message is used.
 820    '''
 821    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 822    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 823    '''
 824    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 825    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 826    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 827    ''' </param>
 828    ''' <param name="eventType">
 829    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 830    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 831    ''' </param>
 832    ''' <param name="eventID">
 833    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 834    ''' </param>
 835    ''' <remarks>
 836    ''' <para>
 837    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 838    ''' </para>
 839    ''' <para>
 840    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 841    ''' </para>
 842    ''' </remarks>
 4843    Public Sub Log(
 4844            ByVal sourceName As String,
 4845            ByVal message As String,
 4846            ByVal eventType As EventLogEntryType,
 4847            ByVal eventID As Integer)
 848
 8849        Log("",
 8850            sourceName,
 8851            message,
 8852            eventType,
 8853            eventID)
 854
 8855    End Sub
 856
 857    ''' <summary>
 858    ''' Writes an entry to the Windows Event Log using the provided parameters.
 859    ''' </summary>
 860    ''' <param name="logName">
 861    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 862    ''' If <c>null</c> or empty, "Application" is used by default.
 863    ''' </param>
 864    ''' <param name="sourceName">
 865    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 866    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 867    ''' </param>
 868    ''' <param name="message">
 869    ''' The message to log. If <c>null</c> or empty, a default message is used.
 870    '''
 871    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 872    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 873    '''
 874    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 875    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 876    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 877    ''' </param>
 878    ''' <param name="eventType">
 879    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 880    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 881    ''' </param>
 882    ''' <param name="eventID">
 883    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 884    ''' </param>
 885    ''' <remarks>
 886    ''' <para>
 887    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 888    ''' </para>
 889    ''' <para>
 890    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 891    ''' </para>
 892    ''' </remarks>
 32893    Public Sub Log(
 32894            ByVal logName As String,
 32895            ByVal sourceName As String,
 32896            ByVal message As String,
 32897            ByVal eventType As EventLogEntryType,
 32898            ByVal eventID As Integer)
 899
 64900        Log(logName,
 64901            sourceName,
 64902            message,
 64903            eventType,
 64904            eventID,
 64905            0)
 906
 64907    End Sub
 908
 909    ''' <summary>
 910    ''' Writes an entry to the Windows Event Log using the provided parameters.
 911    ''' </summary>
 912    ''' <param name="message">
 913    ''' The message to log. If <c>null</c> or empty, a default message is used.
 914    '''
 915    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 916    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 917    '''
 918    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 919    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 920    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 921    ''' </param>
 922    ''' <param name="eventType">
 923    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 924    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 925    ''' </param>
 926    ''' <param name="eventID">
 927    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 928    ''' </param>
 929    ''' <param name="category">
 930    ''' The category for the event, if applicable. This is typically used in categorized event views.
 931    ''' </param>
 932    ''' <remarks>
 933    ''' <para>
 934    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 935    ''' </para>
 936    ''' <para>
 937    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 938    ''' </para>
 939    ''' </remarks>
 4940    Public Sub Log(
 4941            ByVal message As String,
 4942            ByVal eventType As EventLogEntryType,
 4943            ByVal eventID As Integer,
 4944            ByVal category As Short)
 945
 8946        Log("",
 8947            message,
 8948            eventType,
 8949            eventID,
 8950            category)
 951
 8952    End Sub
 953
 954    ''' <summary>
 955    ''' Writes an entry to the Windows Event Log using the provided parameters.
 956    ''' </summary>
 957    ''' <param name="sourceName">
 958    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 959    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 960    ''' </param>
 961    ''' <param name="message">
 962    ''' The message to log. If <c>null</c> or empty, a default message is used.
 963    '''
 964    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 965    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 966    '''
 967    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 968    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 969    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 970    ''' </param>
 971    ''' <param name="eventType">
 972    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 973    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 974    ''' </param>
 975    ''' <param name="eventID">
 976    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 977    ''' </param>
 978    ''' <param name="category">
 979    ''' The category for the event, if applicable. This is typically used in categorized event views.
 980    ''' </param>
 981    ''' <remarks>
 982    ''' <para>
 983    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 984    ''' </para>
 985    ''' <para>
 986    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 987    ''' </para>
 988    ''' </remarks>
 8989    Public Sub Log(
 8990            ByVal sourceName As String,
 8991            ByVal message As String,
 8992            ByVal eventType As EventLogEntryType,
 8993            ByVal eventID As Integer,
 8994            ByVal category As Short)
 995
 16996        Log("",
 16997            sourceName,
 16998            message,
 16999            eventType,
 161000            eventID,
 161001            category)
 1002
 161003    End Sub
 1004
 1005    ''' <summary>
 1006    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1007    ''' </summary>
 1008    ''' <param name="logName">
 1009    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1010    ''' If <c>null</c> or empty, "Application" is used by default.
 1011    ''' </param>
 1012    ''' <param name="sourceName">
 1013    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1014    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1015    ''' </param>
 1016    ''' <param name="message">
 1017    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1018    '''
 1019    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1020    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1021    '''
 1022    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1023    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1024    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1025    ''' </param>
 1026    ''' <param name="eventType">
 1027    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1028    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1029    ''' </param>
 1030    ''' <param name="eventID">
 1031    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1032    ''' </param>
 1033    ''' <param name="category">
 1034    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1035    ''' </param>
 1036    ''' <remarks>
 1037    ''' <para>
 1038    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1039    ''' </para>
 1040    ''' <para>
 1041    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1042    ''' </para>
 1043    ''' </remarks>
 441044    Public Sub Log(
 441045            ByVal logName As String,
 441046            ByVal sourceName As String,
 441047            ByVal message As String,
 441048            ByVal eventType As EventLogEntryType,
 441049            ByVal eventID As Integer,
 441050            ByVal category As Short)
 1051
 881052        Log("",
 881053            logName,
 881054            sourceName,
 881055            message,
 881056            eventType,
 881057            eventID,
 881058            category,
 881059            Nothing)
 1060
 881061    End Sub
 1062
 1063    ''' <summary>
 1064    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1065    ''' </summary>
 1066    ''' <param name="message">
 1067    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1068    '''
 1069    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1070    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1071    '''
 1072    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1073    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1074    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1075    ''' </param>
 1076    ''' <param name="rawData">
 1077    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1078    ''' </param>
 1079    ''' <remarks>
 1080    ''' <para>
 1081    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1082    ''' </para>
 1083    ''' <para>
 1084    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1085    ''' </para>
 1086    ''' </remarks>
 41087    Public Sub Log(
 41088            ByVal message As String,
 41089            ByVal rawData As Byte())
 1090
 81091        Log(message,
 81092            EventLogEntryType.Information,
 81093            rawData)
 1094
 81095    End Sub
 1096
 1097    ''' <summary>
 1098    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1099    ''' </summary>
 1100    ''' <param name="message">
 1101    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1102    '''
 1103    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1104    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1105    '''
 1106    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1107    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1108    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1109    ''' </param>
 1110    ''' <param name="eventType">
 1111    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1112    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1113    ''' </param>
 1114    ''' <param name="rawData">
 1115    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1116    ''' </param>
 1117    ''' <remarks>
 1118    ''' <para>
 1119    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1120    ''' </para>
 1121    ''' <para>
 1122    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1123    ''' </para>
 1124    ''' </remarks>
 81125    Public Sub Log(
 81126            ByVal message As String,
 81127            ByVal eventType As EventLogEntryType,
 81128            ByVal rawData As Byte())
 1129
 161130        Log(message,
 161131            eventType,
 161132            0,
 161133            rawData)
 1134
 161135    End Sub
 1136
 1137    ''' <summary>
 1138    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1139    ''' </summary>
 1140    ''' <param name="message">
 1141    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1142    '''
 1143    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1144    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1145    '''
 1146    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1147    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1148    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1149    ''' </param>
 1150    ''' <param name="eventType">
 1151    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1152    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1153    ''' </param>
 1154    ''' <param name="eventID">
 1155    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1156    ''' </param>
 1157    ''' <param name="rawData">
 1158    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1159    ''' </param>
 1160    ''' <remarks>
 1161    ''' <para>
 1162    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1163    ''' </para>
 1164    ''' <para>
 1165    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1166    ''' </para>
 1167    ''' </remarks>
 121168    Public Sub Log(
 121169            ByVal message As String,
 121170            ByVal eventType As EventLogEntryType,
 121171            ByVal eventID As Integer,
 121172            ByVal rawData As Byte())
 1173
 241174        Log(message,
 241175            eventType,
 241176            eventID,
 241177            0,
 241178            rawData)
 1179
 241180    End Sub
 1181
 1182    ''' <summary>
 1183    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1184    ''' </summary>
 1185    ''' <param name="message">
 1186    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1187    '''
 1188    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1189    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1190    '''
 1191    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1192    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1193    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1194    ''' </param>
 1195    ''' <param name="eventType">
 1196    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1197    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1198    ''' </param>
 1199    ''' <param name="eventID">
 1200    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1201    ''' </param>
 1202    ''' <param name="category">
 1203    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1204    ''' </param>
 1205    ''' <param name="rawData">
 1206    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1207    ''' </param>
 1208    ''' <remarks>
 1209    ''' <para>
 1210    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1211    ''' </para>
 1212    ''' <para>
 1213    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1214    ''' </para>
 1215    ''' </remarks>
 161216    Public Sub Log(
 161217            ByVal message As String,
 161218            ByVal eventType As EventLogEntryType,
 161219            ByVal eventID As Integer,
 161220            ByVal category As Short,
 161221            ByVal rawData As Byte())
 1222
 321223        Log("",
 321224            "",
 321225            "",
 321226            message,
 321227            eventType,
 321228            eventID,
 321229            category,
 321230            rawData)
 1231
 321232    End Sub
 1233
 1234    ''' <summary>
 1235    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1236    ''' </summary>
 1237    ''' <param name="sourceName">
 1238    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1239    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1240    ''' </param>
 1241    ''' <param name="message">
 1242    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1243    '''
 1244    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1245    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1246    '''
 1247    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1248    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1249    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1250    ''' </param>
 1251    ''' <param name="eventType">
 1252    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1253    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1254    ''' </param>
 1255    ''' <param name="eventID">
 1256    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1257    ''' </param>
 1258    ''' <param name="category">
 1259    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1260    ''' </param>
 1261    ''' <param name="rawData">
 1262    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1263    ''' </param>
 1264    ''' <remarks>
 1265    ''' <para>
 1266    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1267    ''' </para>
 1268    ''' <para>
 1269    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1270    ''' </para>
 1271    ''' </remarks>
 41272    Public Sub Log(
 41273            ByVal sourceName As String,
 41274            ByVal message As String,
 41275            ByVal eventType As EventLogEntryType,
 41276            ByVal eventID As Integer,
 41277            ByVal category As Short,
 41278            ByVal rawData As Byte())
 1279
 81280        Log("",
 81281            "",
 81282            sourceName,
 81283            message,
 81284            eventType,
 81285            eventID,
 81286            category,
 81287            rawData)
 1288
 81289    End Sub
 1290
 1291    ''' <summary>
 1292    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1293    ''' </summary>
 1294    ''' <param name="logName">
 1295    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1296    ''' If <c>null</c> or empty, "Application" is used by default.
 1297    ''' </param>
 1298    ''' <param name="source">
 1299    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1300    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1301    ''' </param>
 1302    ''' <param name="message">
 1303    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1304    '''
 1305    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1306    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1307    '''
 1308    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1309    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1310    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1311    ''' </param>
 1312    ''' <param name="eventType">
 1313    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1314    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1315    ''' </param>
 1316    ''' <param name="eventID">
 1317    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1318    ''' </param>
 1319    ''' <param name="category">
 1320    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1321    ''' </param>
 1322    ''' <param name="rawData">
 1323    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1324    ''' </param>
 1325    ''' <remarks>
 1326    ''' <para>
 1327    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1328    ''' </para>
 1329    ''' <para>
 1330    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1331    ''' </para>
 1332    ''' </remarks>
 321333    Public Sub Log(
 321334            ByVal logName As String,
 321335            ByVal source As String,
 321336            ByVal message As String,
 321337            ByVal eventType As EventLogEntryType,
 321338            ByVal eventID As Integer,
 321339            ByVal category As Short,
 321340            ByVal rawData As Byte())
 1341
 641342        Log(
 641343            "",
 641344            logName,
 641345            source,
 641346            message,
 641347            eventType,
 641348            eventID,
 641349            category,
 641350            rawData)
 1351
 641352    End Sub
 1353
 1354    ''' <summary>
 1355    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1356    ''' </summary>
 1357    ''' <param name="logName">
 1358    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1359    ''' If <c>null</c> or empty, "Application" is used by default.
 1360    ''' </param>
 1361    ''' <param name="source">
 1362    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1363    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1364    ''' </param>
 1365    ''' <param name="message">
 1366    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1367    '''
 1368    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1369    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1370    '''
 1371    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1372    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1373    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1374    ''' </param>
 1375    ''' <param name="eventType">
 1376    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1377    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1378    ''' </param>
 1379    ''' <param name="eventID">
 1380    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1381    ''' </param>
 1382    ''' <param name="category">
 1383    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1384    ''' </param>
 1385    ''' <param name="rawData">
 1386    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1387    ''' </param>
 1388    ''' <remarks>
 1389    ''' <para>
 1390    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1391    ''' </para>
 1392    ''' <para>
 1393    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1394    ''' </para>
 1395    ''' </remarks>
 961396    Public Sub Log(
 961397            ByVal machineName As String,
 961398            ByVal logName As String,
 961399            ByVal source As String,
 961400            ByVal message As String,
 961401            ByVal eventType As EventLogEntryType,
 961402            ByVal eventID As Integer,
 961403            ByVal category As Short,
 961404            ByVal rawData As Byte())
 1405
 1921406        Initialize()
 1921407        Log(
 1921408            machineName,
 1921409            logName,
 1921410            source,
 1921411            message,
 1921412            eventType,
 1921413            eventID,
 1921414            category,
 1921415            rawData,
 1921416            MaxKilobytes)
 1417
 1921418    End Sub
 1419
 1420    ''' <summary>
 1421    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1422    ''' </summary>
 1423    ''' <param name="logName">
 1424    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1425    ''' If <c>null</c> or empty, "Application" is used by default.
 1426    ''' </param>
 1427    ''' <param name="source">
 1428    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1429    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1430    ''' </param>
 1431    ''' <param name="message">
 1432    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1433    '''
 1434    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1435    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1436    '''
 1437    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1438    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1439    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1440    ''' </param>
 1441    ''' <param name="eventType">
 1442    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1443    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1444    ''' </param>
 1445    ''' <param name="eventID">
 1446    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1447    ''' </param>
 1448    ''' <param name="category">
 1449    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1450    ''' </param>
 1451    ''' <param name="rawData">
 1452    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1453    ''' </param>
 1454    ''' <param name="maxKilobytes">
 1455    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1456    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1457    ''' </param>
 1458    ''' <remarks>
 1459    ''' <para>
 1460    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1461    ''' </para>
 1462    ''' <para>
 1463    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1464    ''' </para>
 1465    ''' </remarks>
 961466    Public Sub Log(
 961467            ByVal machineName As String,
 961468            ByVal logName As String,
 961469            ByVal source As String,
 961470            ByVal message As String,
 961471            ByVal eventType As EventLogEntryType,
 961472            ByVal eventID As Integer,
 961473            ByVal category As Short,
 961474            ByVal rawData As Byte(),
 961475            ByVal maxKilobytes As Integer)
 1476
 1921477        Initialize()
 1921478        Log(
 1921479            machineName,
 1921480            logName,
 1921481            source,
 1921482            message,
 1921483            eventType,
 1921484            eventID,
 1921485            category,
 1921486            rawData,
 1921487            maxKilobytes,
 1921488            RetentionDays)
 1489
 1921490    End Sub
 1491
 1492    ''' <summary>
 1493    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1494    ''' </summary>
 1495    ''' <param name="message">
 1496    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1497    '''
 1498    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1499    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1500    '''
 1501    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1502    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1503    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1504    ''' </param>
 1505    ''' <param name="maxKilobytes">
 1506    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1507    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1508    ''' </param>
 1509    ''' <param name="retentionDays">
 1510    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 1511    ''' Only used when creating a new log.
 1512    ''' </param>
 1513    ''' <remarks>
 1514    ''' <para>
 1515    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1516    ''' </para>
 1517    ''' <para>
 1518    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1519    ''' </para>
 1520    ''' </remarks>
 41521    Public Sub Log(
 41522            ByVal message As String,
 41523            ByVal maxKilobytes As Integer,
 41524            ByVal retentionDays As Integer)
 1525
 81526        Log(
 81527            message,
 81528            EventLogEntryType.Information,
 81529            maxKilobytes,
 81530            retentionDays)
 1531
 81532    End Sub
 1533
 1534    ''' <summary>
 1535    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1536    ''' </summary>
 1537    ''' <param name="message">
 1538    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1539    '''
 1540    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1541    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1542    '''
 1543    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1544    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1545    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1546    ''' </param>
 1547    ''' <param name="eventType">
 1548    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1549    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1550    ''' </param>
 1551    ''' <param name="maxKilobytes">
 1552    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1553    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1554    ''' </param>
 1555    ''' <param name="retentionDays">
 1556    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 1557    ''' Only used when creating a new log.
 1558    ''' </param>
 1559    ''' <remarks>
 1560    ''' <para>
 1561    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1562    ''' </para>
 1563    ''' <para>
 1564    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1565    ''' </para>
 1566    ''' </remarks>
 41567    Public Sub Log(
 41568            ByVal message As String,
 41569            ByVal eventType As EventLogEntryType,
 41570            ByVal maxKilobytes As Integer,
 41571            ByVal retentionDays As Integer)
 1572
 81573        Log(
 81574            message,
 81575            eventType,
 81576            0,
 81577            maxKilobytes,
 81578            retentionDays)
 1579
 81580    End Sub
 1581
 1582    ''' <summary>
 1583    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1584    ''' </summary>
 1585    ''' <param name="message">
 1586    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1587    '''
 1588    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1589    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1590    '''
 1591    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1592    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1593    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1594    ''' </param>
 1595    ''' <param name="eventType">
 1596    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1597    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1598    ''' </param>
 1599    ''' <param name="eventID">
 1600    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1601    ''' </param>
 1602    ''' <param name="maxKilobytes">
 1603    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1604    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1605    ''' </param>
 1606    ''' <param name="retentionDays">
 1607    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 1608    ''' Only used when creating a new log.
 1609    ''' </param>
 1610    ''' <remarks>
 1611    ''' <para>
 1612    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1613    ''' </para>
 1614    ''' <para>
 1615    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1616    ''' </para>
 1617    ''' </remarks>
 41618    Public Sub Log(
 41619            ByVal message As String,
 41620            ByVal eventType As EventLogEntryType,
 41621            ByVal eventID As Integer,
 41622            ByVal maxKilobytes As Integer,
 41623            ByVal retentionDays As Integer)
 1624
 81625        Log(
 81626            message,
 81627            eventType,
 81628            eventID,
 81629            0,
 81630            maxKilobytes,
 81631            retentionDays)
 1632
 81633    End Sub
 1634
 1635    ''' <summary>
 1636    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1637    ''' </summary>
 1638    ''' <param name="message">
 1639    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1640    '''
 1641    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1642    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1643    '''
 1644    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1645    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1646    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1647    ''' </param>
 1648    ''' <param name="eventType">
 1649    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1650    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1651    ''' </param>
 1652    ''' <param name="eventID">
 1653    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1654    ''' </param>
 1655    ''' <param name="category">
 1656    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1657    ''' </param>
 1658    ''' <param name="maxKilobytes">
 1659    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1660    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1661    ''' </param>
 1662    ''' <param name="retentionDays">
 1663    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 1664    ''' Only used when creating a new log.
 1665    ''' </param>
 1666    ''' <remarks>
 1667    ''' <para>
 1668    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1669    ''' </para>
 1670    ''' <para>
 1671    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1672    ''' </para>
 1673    ''' </remarks>
 41674    Public Sub Log(
 41675            ByVal message As String,
 41676            ByVal eventType As EventLogEntryType,
 41677            ByVal eventID As Integer,
 41678            ByVal category As Short,
 41679            ByVal maxKilobytes As Integer,
 41680            ByVal retentionDays As Integer)
 1681
 81682        Log(
 81683            message,
 81684            eventType,
 81685            eventID,
 81686            category,
 81687            Nothing,
 81688            maxKilobytes,
 81689            retentionDays)
 1690
 81691    End Sub
 1692
 1693    ''' <summary>
 1694    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1695    ''' </summary>
 1696    ''' <param name="message">
 1697    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1698    '''
 1699    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1700    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1701    '''
 1702    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1703    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1704    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1705    ''' </param>
 1706    ''' <param name="eventType">
 1707    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1708    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1709    ''' </param>
 1710    ''' <param name="eventID">
 1711    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1712    ''' </param>
 1713    ''' <param name="category">
 1714    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1715    ''' </param>
 1716    ''' <param name="rawData">
 1717    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1718    ''' </param>
 1719    ''' <param name="maxKilobytes">
 1720    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1721    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1722    ''' </param>
 1723    ''' <param name="retentionDays">
 1724    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 1725    ''' Only used when creating a new log.
 1726    ''' </param>
 1727    ''' <remarks>
 1728    ''' <para>
 1729    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1730    ''' </para>
 1731    ''' <para>
 1732    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1733    ''' </para>
 1734    ''' </remarks>
 41735    Public Sub Log(
 41736            ByVal message As String,
 41737            ByVal eventType As EventLogEntryType,
 41738            ByVal eventID As Integer,
 41739            ByVal category As Short,
 41740            ByVal rawData As Byte(),
 41741            ByVal maxKilobytes As Integer,
 41742            ByVal retentionDays As Integer)
 1743
 81744        Log(
 81745            "",
 81746            message,
 81747            eventType,
 81748            eventID,
 81749            category,
 81750            rawData,
 81751            maxKilobytes,
 81752            retentionDays)
 1753
 81754    End Sub
 1755
 1756    ''' <summary>
 1757    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1758    ''' </summary>
 1759    ''' <param name="source">
 1760    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1761    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1762    ''' </param>
 1763    ''' <param name="message">
 1764    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1765    '''
 1766    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1767    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1768    '''
 1769    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1770    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1771    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1772    ''' </param>
 1773    ''' <param name="eventType">
 1774    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1775    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1776    ''' </param>
 1777    ''' <param name="eventID">
 1778    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1779    ''' </param>
 1780    ''' <param name="category">
 1781    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1782    ''' </param>
 1783    ''' <param name="rawData">
 1784    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1785    ''' </param>
 1786    ''' <param name="maxKilobytes">
 1787    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1788    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1789    ''' </param>
 1790    ''' <param name="retentionDays">
 1791    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 1792    ''' Only used when creating a new log.
 1793    ''' </param>
 1794    ''' <remarks>
 1795    ''' <para>
 1796    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1797    ''' </para>
 1798    ''' <para>
 1799    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1800    ''' </para>
 1801    ''' </remarks>
 41802    Public Sub Log(
 41803            ByVal source As String,
 41804            ByVal message As String,
 41805            ByVal eventType As EventLogEntryType,
 41806            ByVal eventID As Integer,
 41807            ByVal category As Short,
 41808            ByVal rawData As Byte(),
 41809            ByVal maxKilobytes As Integer,
 41810            ByVal retentionDays As Integer)
 1811
 81812        Log(
 81813            "",
 81814            source,
 81815            message,
 81816            eventType,
 81817            eventID,
 81818            category,
 81819            rawData,
 81820            maxKilobytes,
 81821            retentionDays)
 1822
 81823    End Sub
 1824
 1825    ''' <summary>
 1826    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1827    ''' </summary>
 1828    ''' <param name="logName">
 1829    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1830    ''' If <c>null</c> or empty, "Application" is used by default.
 1831    ''' </param>
 1832    ''' <param name="source">
 1833    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1834    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1835    ''' </param>
 1836    ''' <param name="message">
 1837    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1838    '''
 1839    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1840    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1841    '''
 1842    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1843    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1844    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1845    ''' </param>
 1846    ''' <param name="eventType">
 1847    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1848    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1849    ''' </param>
 1850    ''' <param name="eventID">
 1851    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1852    ''' </param>
 1853    ''' <param name="category">
 1854    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1855    ''' </param>
 1856    ''' <param name="rawData">
 1857    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1858    ''' </param>
 1859    ''' <param name="maxKilobytes">
 1860    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1861    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1862    ''' </param>
 1863    ''' <param name="retentionDays">
 1864    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 1865    ''' Only used when creating a new log.
 1866    ''' </param>
 1867    ''' <remarks>
 1868    ''' <para>
 1869    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1870    ''' </para>
 1871    ''' <para>
 1872    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1873    ''' </para>
 1874    ''' </remarks>
 41875    Public Sub Log(
 41876            ByVal logName As String,
 41877            ByVal source As String,
 41878            ByVal message As String,
 41879            ByVal eventType As EventLogEntryType,
 41880            ByVal eventID As Integer,
 41881            ByVal category As Short,
 41882            ByVal rawData As Byte(),
 41883            ByVal maxKilobytes As Integer,
 41884            ByVal retentionDays As Integer)
 1885
 81886        Log(
 81887            "",
 81888            logName,
 81889            source,
 81890            message,
 81891            eventType,
 81892            eventID,
 81893            category,
 81894            rawData,
 81895            maxKilobytes,
 81896            retentionDays)
 1897
 81898    End Sub
 1899
 1900    ''' <summary>
 1901    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1902    ''' </summary>
 1903    ''' <param name="logName">
 1904    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 1905    ''' If <c>null</c> or empty, "Application" is used by default.
 1906    ''' </param>
 1907    ''' <param name="source">
 1908    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 1909    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 1910    ''' </param>
 1911    ''' <param name="message">
 1912    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1913    '''
 1914    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1915    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1916    '''
 1917    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1918    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1919    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1920    ''' </param>
 1921    ''' <param name="eventType">
 1922    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 1923    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 1924    ''' </param>
 1925    ''' <param name="eventID">
 1926    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 1927    ''' </param>
 1928    ''' <param name="category">
 1929    ''' The category for the event, if applicable. This is typically used in categorized event views.
 1930    ''' </param>
 1931    ''' <param name="rawData">
 1932    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 1933    ''' </param>
 1934    ''' <param name="maxKilobytes">
 1935    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1936    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1937    ''' </param>
 1938    ''' <param name="retentionDays">
 1939    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 1940    ''' Only used when creating a new log.
 1941    ''' </param>
 1942    ''' <remarks>
 1943    ''' <para>
 1944    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 1945    ''' </para>
 1946    ''' <para>
 1947    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 1948    ''' </para>
 1949    ''' </remarks>
 1001950    Public Sub Log(
 1001951            ByVal machineName As String,
 1001952            ByVal logName As String,
 1001953            ByVal source As String,
 1001954            ByVal message As String,
 1001955            ByVal eventType As EventLogEntryType,
 1001956            ByVal eventID As Integer,
 1001957            ByVal category As Short,
 1001958            ByVal rawData As Byte(),
 1001959            ByVal maxKilobytes As Integer,
 1001960            ByVal retentionDays As Integer)
 1961
 2001962        Initialize()
 1963
 2001964        Log(
 2001965            machineName,
 2001966            logName,
 2001967            source,
 2001968            message,
 2001969            eventType,
 2001970            eventID,
 2001971            category,
 2001972            rawData,
 2001973            maxKilobytes,
 2001974            retentionDays,
 2001975            WriteInitEntry)
 1976
 2001977    End Sub
 1978
 1979    ''' <summary>
 1980    ''' Writes an entry to the Windows Event Log using the provided parameters.
 1981    ''' </summary>
 1982    ''' <param name="message">
 1983    ''' The message to log. If <c>null</c> or empty, a default message is used.
 1984    '''
 1985    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 1986    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 1987    '''
 1988    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 1989    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 1990    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 1991    ''' </param>
 1992    ''' <param name="maxKilobytes">
 1993    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 1994    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 1995    ''' </param>
 1996    ''' <param name="retentionDays">
 1997    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 1998    ''' Only used when creating a new log.
 1999    ''' </param>
 2000    ''' <param name="writeInitEntry">
 2001    ''' Indicates whether an initialization entry should be written when a new log is created.
 2002    ''' </param>
 2003    ''' <remarks>
 2004    ''' <para>
 2005    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2006    ''' </para>
 2007    ''' <para>
 2008    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2009    ''' </para>
 2010    ''' </remarks>
 42011    Public Sub Log(
 42012            ByVal message As String,
 42013            ByVal maxKilobytes As Integer,
 42014            ByVal retentionDays As Integer,
 42015            ByVal writeInitEntry As Boolean)
 2016
 82017        Log(
 82018            message,
 82019            EventLogEntryType.Information,
 82020            maxKilobytes,
 82021            retentionDays,
 82022            writeInitEntry)
 2023
 82024    End Sub
 2025
 2026    ''' <summary>
 2027    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2028    ''' </summary>
 2029    ''' <param name="message">
 2030    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2031    '''
 2032    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2033    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2034    '''
 2035    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2036    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2037    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2038    ''' </param>
 2039    ''' <param name="eventType">
 2040    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2041    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2042    ''' </param>
 2043    ''' <param name="maxKilobytes">
 2044    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2045    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2046    ''' </param>
 2047    ''' <param name="retentionDays">
 2048    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2049    ''' Only used when creating a new log.
 2050    ''' </param>
 2051    ''' <param name="writeInitEntry">
 2052    ''' Indicates whether an initialization entry should be written when a new log is created.
 2053    ''' </param>
 2054    ''' <remarks>
 2055    ''' <para>
 2056    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2057    ''' </para>
 2058    ''' <para>
 2059    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2060    ''' </para>
 2061    ''' </remarks>
 42062    Public Sub Log(
 42063            ByVal message As String,
 42064            ByVal eventType As EventLogEntryType,
 42065            ByVal maxKilobytes As Integer,
 42066            ByVal retentionDays As Integer,
 42067            ByVal writeInitEntry As Boolean)
 2068
 82069        Log(
 82070            message,
 82071            eventType,
 82072            0,
 82073            maxKilobytes,
 82074            retentionDays,
 82075            writeInitEntry)
 2076
 82077    End Sub
 2078
 2079    ''' <summary>
 2080    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2081    ''' </summary>
 2082    ''' <param name="message">
 2083    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2084    '''
 2085    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2086    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2087    '''
 2088    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2089    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2090    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2091    ''' </param>
 2092    ''' <param name="eventType">
 2093    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2094    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2095    ''' </param>
 2096    ''' <param name="eventID">
 2097    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2098    ''' </param>
 2099    ''' <param name="maxKilobytes">
 2100    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2101    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2102    ''' </param>
 2103    ''' <param name="retentionDays">
 2104    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2105    ''' Only used when creating a new log.
 2106    ''' </param>
 2107    ''' <param name="writeInitEntry">
 2108    ''' Indicates whether an initialization entry should be written when a new log is created.
 2109    ''' </param>
 2110    ''' <remarks>
 2111    ''' <para>
 2112    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2113    ''' </para>
 2114    ''' <para>
 2115    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2116    ''' </para>
 2117    ''' </remarks>
 42118    Public Sub Log(
 42119            ByVal message As String,
 42120            ByVal eventType As EventLogEntryType,
 42121            ByVal eventID As Integer,
 42122            ByVal maxKilobytes As Integer,
 42123            ByVal retentionDays As Integer,
 42124            ByVal writeInitEntry As Boolean)
 2125
 82126        Log(
 82127            message,
 82128            eventType,
 82129            eventID,
 82130            0,
 82131            maxKilobytes,
 82132            retentionDays,
 82133            writeInitEntry)
 2134
 82135    End Sub
 2136
 2137    ''' <summary>
 2138    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2139    ''' </summary>
 2140    ''' <param name="message">
 2141    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2142    '''
 2143    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2144    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2145    '''
 2146    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2147    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2148    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2149    ''' </param>
 2150    ''' <param name="eventType">
 2151    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2152    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2153    ''' </param>
 2154    ''' <param name="eventID">
 2155    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2156    ''' </param>
 2157    ''' <param name="category">
 2158    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2159    ''' </param>
 2160    ''' <param name="maxKilobytes">
 2161    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2162    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2163    ''' </param>
 2164    ''' <param name="retentionDays">
 2165    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2166    ''' Only used when creating a new log.
 2167    ''' </param>
 2168    ''' <param name="writeInitEntry">
 2169    ''' Indicates whether an initialization entry should be written when a new log is created.
 2170    ''' </param>
 2171    ''' <remarks>
 2172    ''' <para>
 2173    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2174    ''' </para>
 2175    ''' <para>
 2176    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2177    ''' </para>
 2178    ''' </remarks>
 42179    Public Sub Log(
 42180            ByVal message As String,
 42181            ByVal eventType As EventLogEntryType,
 42182            ByVal eventID As Integer,
 42183            ByVal category As Short,
 42184            ByVal maxKilobytes As Integer,
 42185            ByVal retentionDays As Integer,
 42186            ByVal writeInitEntry As Boolean)
 2187
 82188        Log(
 82189            message,
 82190            eventType,
 82191            eventID,
 82192            category,
 82193            Nothing,
 82194            maxKilobytes,
 82195            retentionDays,
 82196            writeInitEntry)
 2197
 82198    End Sub
 2199
 2200    ''' <summary>
 2201    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2202    ''' </summary>
 2203    ''' <param name="message">
 2204    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2205    '''
 2206    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2207    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2208    '''
 2209    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2210    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2211    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2212    ''' </param>
 2213    ''' <param name="eventType">
 2214    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2215    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2216    ''' </param>
 2217    ''' <param name="eventID">
 2218    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2219    ''' </param>
 2220    ''' <param name="category">
 2221    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2222    ''' </param>
 2223    ''' <param name="rawData">
 2224    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2225    ''' </param>
 2226    ''' <param name="maxKilobytes">
 2227    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2228    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2229    ''' </param>
 2230    ''' <param name="retentionDays">
 2231    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2232    ''' Only used when creating a new log.
 2233    ''' </param>
 2234    ''' <param name="writeInitEntry">
 2235    ''' Indicates whether an initialization entry should be written when a new log is created.
 2236    ''' </param>
 2237    ''' <remarks>
 2238    ''' <para>
 2239    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2240    ''' </para>
 2241    ''' <para>
 2242    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2243    ''' </para>
 2244    ''' </remarks>
 42245    Public Sub Log(
 42246            ByVal message As String,
 42247            ByVal eventType As EventLogEntryType,
 42248            ByVal eventID As Integer,
 42249            ByVal category As Short,
 42250            ByVal rawData As Byte(),
 42251            ByVal maxKilobytes As Integer,
 42252            ByVal retentionDays As Integer,
 42253            ByVal writeInitEntry As Boolean)
 2254
 82255        Log(
 82256            "",
 82257            message,
 82258            eventType,
 82259            eventID,
 82260            category,
 82261            rawData,
 82262            maxKilobytes,
 82263            retentionDays,
 82264            writeInitEntry)
 2265
 82266    End Sub
 2267
 2268    ''' <summary>
 2269    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2270    ''' </summary>
 2271    ''' <param name="sourceName">
 2272    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2273    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2274    ''' </param>
 2275    ''' <param name="message">
 2276    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2277    '''
 2278    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2279    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2280    '''
 2281    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2282    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2283    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2284    ''' </param>
 2285    ''' <param name="eventType">
 2286    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2287    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2288    ''' </param>
 2289    ''' <param name="eventID">
 2290    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2291    ''' </param>
 2292    ''' <param name="category">
 2293    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2294    ''' </param>
 2295    ''' <param name="rawData">
 2296    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2297    ''' </param>
 2298    ''' <param name="maxKilobytes">
 2299    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2300    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2301    ''' </param>
 2302    ''' <param name="retentionDays">
 2303    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2304    ''' Only used when creating a new log.
 2305    ''' </param>
 2306    ''' <param name="writeInitEntry">
 2307    ''' Indicates whether an initialization entry should be written when a new log is created.
 2308    ''' </param>
 2309    ''' <remarks>
 2310    ''' <para>
 2311    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2312    ''' </para>
 2313    ''' <para>
 2314    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2315    ''' </para>
 2316    ''' </remarks>
 42317    Public Sub Log(
 42318            ByVal sourceName As String,
 42319            ByVal message As String,
 42320            ByVal eventType As EventLogEntryType,
 42321            ByVal eventID As Integer,
 42322            ByVal category As Short,
 42323            ByVal rawData As Byte(),
 42324            ByVal maxKilobytes As Integer,
 42325            ByVal retentionDays As Integer,
 42326            ByVal writeInitEntry As Boolean)
 2327
 82328        Log(
 82329            "",
 82330            sourceName,
 82331            message,
 82332            eventType,
 82333            eventID,
 82334            category,
 82335            rawData,
 82336            maxKilobytes,
 82337            retentionDays,
 82338            writeInitEntry)
 2339
 82340    End Sub
 2341
 2342    ''' <summary>
 2343    ''' Writes an entry to the Windows Event Log using the provided parameters.
 2344    ''' </summary>
 2345    ''' <param name="logName">
 2346    ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name).
 2347    ''' If <c>null</c> or empty, "Application" is used by default.
 2348    ''' </param>
 2349    ''' <param name="sourceName">
 2350    ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's
 2351    ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated.
 2352    ''' </param>
 2353    ''' <param name="message">
 2354    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2355    '''
 2356    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2357    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2358    '''
 2359    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2360    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2361    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2362    ''' </param>
 2363    ''' <param name="eventType">
 2364    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2365    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2366    ''' </param>
 2367    ''' <param name="eventID">
 2368    ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve
 2369    ''' </param>
 2370    ''' <param name="category">
 2371    ''' The category for the event, if applicable. This is typically used in categorized event views.
 2372    ''' </param>
 2373    ''' <param name="rawData">
 2374    ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used.
 2375    ''' </param>
 2376    ''' <param name="maxKilobytes">
 2377    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 2378    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 2379    ''' </param>
 2380    ''' <param name="retentionDays">
 2381    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 2382    ''' Only used when creating a new log.
 2383    ''' </param>
 2384    ''' <param name="writeInitEntry">
 2385    ''' Indicates whether an initialization entry should be written when a new log is created.
 2386    ''' </param>
 2387    ''' <remarks>
 2388    ''' <para>
 2389    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2390    ''' </para>
 2391    ''' <para>
 2392    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2393    ''' </para>
 2394    ''' </remarks>
 42395    Public Sub Log(
 42396            ByVal logName As String,
 42397            ByVal sourceName As String,
 42398            ByVal message As String,
 42399            ByVal eventType As EventLogEntryType,
 42400            ByVal eventID As Integer,
 42401            ByVal category As Short,
 42402            ByVal rawData As Byte(),
 42403            ByVal maxKilobytes As Integer,
 42404            ByVal retentionDays As Integer,
 42405            ByVal writeInitEntry As Boolean)
 2406
 82407        Log(
 82408            "",
 82409            logName,
 82410            sourceName,
 82411            message,
 82412            eventType,
 82413            eventID,
 82414            category,
 82415            rawData,
 82416            maxKilobytes,
 82417            retentionDays,
 82418            writeInitEntry)
 2419
 82420    End Sub
 2421
 2422    ''' <summary>
 2423    ''' Writes an entry (or entries) to the Windows Event Log using the specified parameters.
 2424    ''' </summary>
 2425    ''' <param name="_machineName">
 2426    ''' The name of the machine where the event log resides. Use <c>"."</c> for the local machine.
 2427    ''' If <c>null</c> or empty, the local machine is used by default, or the value of the <see cref="MachineName"/> pro
 2428    ''' </param>
 2429    ''' <param name="_logName">
 2430    ''' The name of the event log (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 2431    ''' If <c>null</c> or empty, the value of the <see cref="LogName"/> property is used.
 2432    ''' </param>
 2433    ''' <param name="sourceName">
 2434    ''' The source name for the event entry. If <c>null</c> or empty, a source is auto-generated from the calling method
 2435    ''' If the resulting name exceeds 254 characters, it will be truncated.
 2436    ''' </param>
 2437    ''' <param name="message">
 2438    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2439    '''
 2440    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2441    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2442    '''
 2443    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2444    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2445    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2446    ''' </param>
 2447    ''' <param name="eventType">
 2448    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2449    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2450    ''' </param>
 2451    ''' <param name="eventID">
 2452    ''' The numeric event identifier. Application-defined and useful for grouping related events.
 2453    ''' </param>
 2454    ''' <param name="category">
 2455    ''' The category ID for the event. Use 0 if not applicable.
 2456    ''' </param>
 2457    ''' <param name="rawData">
 2458    ''' Optional binary data to associate with the event. Can be <c>null</c>.
 2459    ''' </param>
 2460    ''' <param name="maxKilobytes">
 2461    ''' The maximum size of the event log in kilobytes. Only applies when creating a new log. Range: 64 KB – 4 GB.
 2462    ''' </param>
 2463    ''' <param name="retentionDays">
 2464    ''' The number of days entries should be retained. 0 means entries are kept indefinitely.
 2465    ''' Applies only when creating a new log.
 2466    ''' </param>
 2467    ''' <param name="writeInitEntry">
 2468    ''' Whether to write an initialization entry when a new log is created.
 2469    ''' </param>
 2470    ''' <remarks>
 2471    ''' <para>
 2472    ''' If the specified event log or source does not exist, they are created automatically using the provided parameter
 2473    ''' </para>
 2474    ''' <para>
 2475    ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti
 2476    ''' </para>
 2477    ''' </remarks>
 1042478    Public Sub Log(
 1042479            ByVal _machineName As String,
 1042480            ByVal _logName As String,
 1042481            ByVal sourceName As String,
 1042482            ByVal message As String,
 1042483            ByVal eventType As EventLogEntryType,
 1042484            ByVal eventID As Integer,
 1042485            ByVal category As Short,
 1042486            ByVal rawData As Byte(),
 1042487            ByVal maxKilobytes As Integer,
 1042488            ByVal retentionDays As Integer,
 1042489            ByVal writeInitEntry As Boolean)
 2490
 2082491        Initialize()
 2492
 2082493        Dim defaultLog As String = If(String.IsNullOrEmpty(_logName), LogName, _logName.Trim())
 2082494        Dim defaultSource As String = Source(sourceName)
 2082495        Dim defaultMachine As String = NormalizeMachineName(_machineName)
 2496
 2082497        If Not _writer.Exists(defaultLog, defaultMachine) OrElse Not _writer.SourceExists(defaultSource, defaultMachine)
 1842498            _writer.CreateEventSource(defaultSource, defaultLog, _machineName)
 1962499        End If
 2500
 2082501        Dim finalEventType As EventLogEntryType = NormalizeEventType(eventType)
 2502
 2082503        If AllowMultiEntryMessages AndAlso message.Length > 32766 Then
 82504            For Each chunk As String In SplitMessageIntoPages(defaultSource, message)
 162505                _writer.WriteEntry(defaultMachine,
 162506                           defaultLog,
 162507                           defaultSource,
 162508                           chunk,
 162509                           finalEventType,
 162510                           eventID,
 162511                           category,
 162512                           rawData,
 162513                           maxKilobytes,
 162514                           retentionDays,
 162515                           writeInitEntry)
 82516            Next
 1002517        Else
 2002518            _writer.WriteEntry(defaultMachine,
 2002519                               defaultLog,
 2002520                               defaultSource,
 2002521                               NormalizeMessage(defaultSource, message),
 2002522                               finalEventType,
 2002523                               eventID,
 2002524                               category,
 2002525                               rawData,
 2002526                               maxKilobytes,
 2002527                               retentionDays,
 2002528                               writeInitEntry)
 1042529        End If
 2530
 2082531    End Sub
 2532
 2533#End Region
 2534
 2535#Region " Log Extension Methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 2536
 2537    ''' <summary>
 2538    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2539    ''' </summary>
 2540    ''' <param name="eventLog">
 2541    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2542    ''' with a valid log name and source.
 2543    ''' </param>
 2544    ''' <param name="message">
 2545    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2546    '''
 2547    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2548    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2549    '''
 2550    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2551    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2552    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2553    ''' </param>
 2554    ''' <remarks>
 2555    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2556    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2557    ''' to intercept and test log output without writing to the system Event Log.
 2558    ''' </remarks>
 2559    <Extension>
 42560    Public Sub LogEntry(
 42561            ByVal eventLog As EventLog,
 42562            ByVal message As String)
 2563
 82564        LogEntry(eventLog,
 82565                 message,
 82566                 EventLogEntryType.Information)
 2567
 82568    End Sub
 2569
 2570    ''' <summary>
 2571    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2572    ''' </summary>
 2573    ''' <param name="eventLog">
 2574    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2575    ''' with a valid log name and source.
 2576    ''' </param>
 2577    ''' <param name="message">
 2578    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2579    '''
 2580    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2581    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2582    '''
 2583    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2584    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2585    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2586    ''' </param>
 2587    ''' <param name="eventType">
 2588    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2589    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2590    ''' </param>
 2591    ''' <remarks>
 2592    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2593    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2594    ''' to intercept and test log output without writing to the system Event Log.
 2595    ''' </remarks>
 2596    <Extension>
 42597    Public Sub LogEntry(
 42598            ByVal eventLog As EventLog,
 42599            ByVal message As String,
 42600            ByVal eventType As EventLogEntryType)
 2601
 82602        LogEntry(eventLog,
 82603                 message,
 82604                 eventType,
 82605                 0)
 2606
 82607    End Sub
 2608
 2609    ''' <summary>
 2610    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2611    ''' </summary>
 2612    ''' <param name="eventLog">
 2613    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2614    ''' with a valid log name and source.
 2615    ''' </param>
 2616    ''' <param name="message">
 2617    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2618    '''
 2619    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2620    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2621    '''
 2622    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2623    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2624    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2625    ''' </param>
 2626    ''' <param name="eventID">
 2627    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 2628    ''' or filtering related log entries.
 2629    ''' </param>
 2630    ''' <remarks>
 2631    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2632    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2633    ''' to intercept and test log output without writing to the system Event Log.
 2634    ''' </remarks>
 2635    <Extension>
 42636    Public Sub LogEntry(
 42637            ByVal eventLog As EventLog,
 42638            ByVal message As String,
 42639            ByVal eventID As Integer)
 2640
 82641        LogEntry(eventLog,
 82642                 message,
 82643                 EventLogEntryType.Information,
 82644                 eventID)
 2645
 82646    End Sub
 2647
 2648    ''' <summary>
 2649    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2650    ''' </summary>
 2651    ''' <param name="eventLog">
 2652    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2653    ''' with a valid log name and source.
 2654    ''' </param>
 2655    ''' <param name="message">
 2656    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2657    '''
 2658    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2659    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2660    '''
 2661    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2662    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2663    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2664    ''' </param>
 2665    ''' <param name="category">
 2666    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 2667    ''' Use 0 if no category is needed.
 2668    ''' </param>
 2669    ''' <remarks>
 2670    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2671    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2672    ''' to intercept and test log output without writing to the system Event Log.
 2673    ''' </remarks>
 2674    <Extension>
 42675    Public Sub LogEntry(
 42676            ByVal eventLog As EventLog,
 42677            ByVal message As String,
 42678            ByVal category As Short)
 2679
 82680        LogEntry(eventLog,
 82681                 message,
 82682                 EventLogEntryType.Information,
 82683                 category)
 2684
 82685    End Sub
 2686
 2687    ''' <summary>
 2688    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2689    ''' </summary>
 2690    ''' <param name="eventLog">
 2691    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2692    ''' with a valid log name and source.
 2693    ''' </param>
 2694    ''' <param name="message">
 2695    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2696    '''
 2697    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2698    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2699    '''
 2700    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2701    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2702    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2703    ''' </param>
 2704    ''' <param name="eventType">
 2705    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2706    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2707    ''' </param>
 2708    ''' <param name="eventID">
 2709    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 2710    ''' or filtering related log entries.
 2711    ''' </param>
 2712    ''' <remarks>
 2713    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2714    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2715    ''' to intercept and test log output without writing to the system Event Log.
 2716    ''' </remarks>
 2717    <Extension>
 82718    Public Sub LogEntry(
 82719            ByVal eventLog As EventLog,
 82720            ByVal message As String,
 82721            ByVal eventType As EventLogEntryType,
 82722            ByVal eventID As Integer)
 2723
 162724        LogEntry(eventLog,
 162725                 message,
 162726                 eventType,
 162727                 eventID,
 162728                 0)
 2729
 162730    End Sub
 2731
 2732    ''' <summary>
 2733    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2734    ''' </summary>
 2735    ''' <param name="eventLog">
 2736    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2737    ''' with a valid log name and source.
 2738    ''' </param>
 2739    ''' <param name="message">
 2740    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2741    '''
 2742    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2743    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2744    '''
 2745    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2746    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2747    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2748    ''' </param>
 2749    ''' <param name="eventType">
 2750    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2751    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2752    ''' </param>
 2753    ''' <param name="category">
 2754    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 2755    ''' Use 0 if no category is needed.
 2756    ''' </param>
 2757    ''' <remarks>
 2758    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2759    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2760    ''' to intercept and test log output without writing to the system Event Log.
 2761    ''' </remarks>
 2762    <Extension>
 42763    Public Sub LogEntry(
 42764            ByVal eventLog As EventLog,
 42765            ByVal message As String,
 42766            ByVal eventType As EventLogEntryType,
 42767            ByVal category As Short)
 2768
 82769        LogEntry(eventLog,
 82770                 message,
 82771                 eventType,
 82772                 0,
 82773                 category)
 2774
 82775    End Sub
 2776
 2777    ''' <summary>
 2778    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2779    ''' </summary>
 2780    ''' <param name="eventLog">
 2781    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2782    ''' with a valid log name and source.
 2783    ''' </param>
 2784    ''' <param name="message">
 2785    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2786    '''
 2787    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2788    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2789    '''
 2790    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2791    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2792    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2793    ''' </param>
 2794    ''' <param name="eventType">
 2795    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2796    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2797    ''' </param>
 2798    ''' <param name="eventID">
 2799    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 2800    ''' or filtering related log entries.
 2801    ''' </param>
 2802    ''' <param name="category">
 2803    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 2804    ''' Use 0 if no category is needed.
 2805    ''' </param>
 2806    ''' <remarks>
 2807    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2808    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2809    ''' to intercept and test log output without writing to the system Event Log.
 2810    ''' </remarks>
 2811    <Extension>
 122812    Public Sub LogEntry(
 122813            ByVal eventLog As EventLog,
 122814            ByVal message As String,
 122815            ByVal eventType As EventLogEntryType,
 122816            ByVal eventID As Integer,
 122817            ByVal category As Short)
 2818
 242819        LogEntry(eventLog,
 242820                 message,
 242821                 eventType,
 242822                 eventID,
 242823                 category,
 242824                 Nothing)
 2825
 242826    End Sub
 2827
 2828    ''' <summary>
 2829    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2830    ''' </summary>
 2831    ''' <param name="eventLog">
 2832    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2833    ''' with a valid log name and source.
 2834    ''' </param>
 2835    ''' <param name="message">
 2836    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2837    '''
 2838    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2839    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2840    '''
 2841    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2842    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2843    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2844    ''' </param>
 2845    ''' <param name="rawData">
 2846    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 2847    ''' </param>
 2848    ''' <remarks>
 2849    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2850    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2851    ''' to intercept and test log output without writing to the system Event Log.
 2852    ''' </remarks>
 2853    <Extension>
 82854    Public Sub LogEntry(
 82855            ByVal eventLog As EventLog,
 82856            ByVal message As String,
 82857            ByVal rawData As Byte())
 2858
 162859        LogEntry(eventLog,
 162860                 message,
 162861                 EventLogEntryType.Information,
 162862                 rawData)
 2863
 162864    End Sub
 2865
 2866    ''' <summary>
 2867    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2868    ''' </summary>
 2869    ''' <param name="eventLog">
 2870    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2871    ''' with a valid log name and source.
 2872    ''' </param>
 2873    ''' <param name="message">
 2874    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2875    '''
 2876    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2877    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2878    '''
 2879    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2880    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2881    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2882    ''' </param>
 2883    ''' <param name="eventType">
 2884    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2885    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2886    ''' </param>
 2887    ''' <param name="rawData">
 2888    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 2889    ''' </param>
 2890    ''' <remarks>
 2891    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2892    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2893    ''' to intercept and test log output without writing to the system Event Log.
 2894    ''' </remarks>
 2895    <Extension>
 82896    Public Sub LogEntry(
 82897            ByVal eventLog As EventLog,
 82898            ByVal message As String,
 82899            ByVal eventType As EventLogEntryType,
 82900            ByVal rawData As Byte())
 2901
 162902        LogEntry(eventLog,
 162903                 message,
 162904                 eventType,
 162905                 0,
 162906                 rawData)
 2907
 162908    End Sub
 2909
 2910    ''' <summary>
 2911    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2912    ''' </summary>
 2913    ''' <param name="eventLog">
 2914    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2915    ''' with a valid log name and source.
 2916    ''' </param>
 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="eventID">
 2932    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 2933    ''' or filtering related log entries.
 2934    ''' </param>
 2935    ''' <param name="rawData">
 2936    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 2937    ''' </param>
 2938    ''' <remarks>
 2939    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2940    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2941    ''' to intercept and test log output without writing to the system Event Log.
 2942    ''' </remarks>
 2943    <Extension>
 82944    Public Sub LogEntry(
 82945            ByVal eventLog As EventLog,
 82946            ByVal message As String,
 82947            ByVal eventType As EventLogEntryType,
 82948            ByVal eventID As Integer,
 82949            ByVal rawData As Byte())
 2950
 162951        LogEntry(eventLog,
 162952                 message,
 162953                 eventType,
 162954                 eventID,
 162955                 0,
 162956                 rawData)
 2957
 162958    End Sub
 2959
 2960    ''' <summary>
 2961    ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters.
 2962    ''' </summary>
 2963    ''' <param name="eventLog">
 2964    ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized
 2965    ''' with a valid log name and source.
 2966    ''' </param>
 2967    ''' <param name="message">
 2968    ''' The message to log. If <c>null</c> or empty, a default message is used.
 2969    '''
 2970    ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t
 2971    ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>).
 2972    '''
 2973    ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries,
 2974    ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with
 2975    ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation.
 2976    ''' </param>
 2977    ''' <param name="eventType">
 2978    ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning"
 2979    ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used.
 2980    ''' </param>
 2981    ''' <param name="eventID">
 2982    ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing
 2983    ''' or filtering related log entries.
 2984    ''' </param>
 2985    ''' <param name="category">
 2986    ''' A numeric category for the event. This is typically used in categorized views of the Event Log.
 2987    ''' Use 0 if no category is needed.
 2988    ''' </param>
 2989    ''' <param name="rawData">
 2990    ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused.
 2991    ''' </param>
 2992    ''' <remarks>
 2993    ''' This method uses configured or default values for formatting and fallbacks. The message is normalized
 2994    ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured
 2995    ''' to intercept and test log output without writing to the system Event Log.
 2996    ''' </remarks>
 2997    <Extension>
 242998    Public Sub LogEntry(
 242999            ByVal eventLog As EventLog,
 243000            ByVal message As String,
 243001            ByVal eventType As EventLogEntryType,
 243002            ByVal eventID As Integer,
 243003            ByVal category As Short,
 243004            ByVal rawData As Byte())
 3005
 483006        Initialize() ' By the time we get here, this should already be done, but just in case.
 3007
 483008        Dim defaultSource As String = Source(eventLog.Source)
 483009        Dim finalEventType As EventLogEntryType = NormalizeEventType(eventType)
 3010
 483011        If AllowMultiEntryMessages AndAlso message.Length > 32766 Then
 83012            For Each chunk As String In SplitMessageIntoPages(defaultSource, message)
 163013                _writer.WriteEntry(eventLog,
 163014                           chunk,
 163015                           finalEventType,
 163016                           eventID,
 163017                           category,
 163018                           rawData)
 83019            Next
 203020        Else
 403021            _writer.WriteEntry(eventLog,
 403022                               NormalizeMessage(eventLog.Source, message),
 403023                               NormalizeEventType(eventType),
 403024                               eventID,
 403025                               category,
 403026                               rawData)
 243027        End If
 3028
 483029    End Sub
 3030
 3031#End Region
 3032
 3033#Region " Support Functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 3034
 3035    ''' <summary>
 3036    ''' Returns a default event source name. If none is provided, this attempts to determine the calling
 3037    ''' method's fully qualified name as the source.
 3038    ''' </summary>
 3039    ''' <param name="_sourceName">Optional. A specific source name to use. If null or empty, the calling method will be 
 3040    ''' <returns>A valid event source name derived from the input or calling method.</returns>
 2643041    Public Function Source(
 2643042            Optional ByVal _sourceName As String = Nothing) As String
 3043
 3044        ' Final fallback if nothing else is available
 5283045        Dim strReturn As String = "SmartEventLogger"
 3046
 5283047        If String.IsNullOrEmpty(_sourceName) Then
 1363048            If Not String.IsNullOrEmpty(SourceName) Then
 243049                strReturn = SourceName
 563050            Else
 3051                ' Try to get the calling assembly (e.g., the one calling your library)
 1123052                Dim thisAssembly As Assembly = Assembly.GetExecutingAssembly()
 3053
 1123054                Dim stackTrace As New StackTrace()
 1123055                For i As Integer = 1 To stackTrace.FrameCount - 1
 7963056                    Dim frame As StackFrame = stackTrace.GetFrame(i)
 7963057                    Dim method As MethodBase = frame.GetMethod()
 7963058                    Dim type As Type = method.DeclaringType
 7963059                    If type.Assembly IsNot thisAssembly Then
 1123060                        strReturn = $"{type.FullName}.{method.Name}"
 1123061                        Exit For
 3423062                    End If
 6843063                Next
 803064            End If
 1963065        Else
 3923066            strReturn = _sourceName.Trim()
 2643067        End If
 3068
 3069        ' Ensure the source name does not exceed the maximum length allowed by the Windows Event Log system
 5283070        Return MaxSource(strReturn)
 3071
 5283072    End Function
 3073
 3074    ''' <summary>
 3075    ''' Attempts to determine a default source name for the given event log by inspecting the registry.
 3076    ''' </summary>
 3077    ''' <param name="log">The name of the event log (e.g., "Application", "System").</param>
 3078    ''' <returns>The name of a registered event source, or an empty string if none are found.</returns>
 43079    Public Function DefaultSource(
 43080            ByVal log As String) As String
 3081
 83082        Initialize()
 3083
 83084        Return DefaultSource(log, MachineName)
 3085
 83086    End Function
 3087
 3088    ''' <summary>
 3089    ''' Attempts to determine a default source name for the given event log by inspecting the registry.
 3090    ''' </summary>
 3091    ''' <param name="logName">The name of the event log (e.g., "Application", "System").</param>
 3092    ''' <param name="machineName">The target machine name, or "." for the local machine.</param>
 3093    ''' <returns>The name of a registered event source, or an empty string if none are found.</returns>
 43094    Public Function DefaultSource(
 43095            ByVal logName As String,
 43096            ByVal machineName As String) As String
 3097
 83098        Return _registryReader.GetDefaultEventLogSource(logName, machineName)
 3099
 83100    End Function
 3101
 3102    ''' <summary>
 3103    ''' Truncates the source name to meet the maximum length allowed by the Windows Event Log system.
 3104    ''' </summary>
 3105    ''' <param name="sourceName">The original source name.</param>
 3106    ''' <returns>A source name no longer than 211 characters.</returns>
 3107    ''' <remarks>
 3108    ''' If the input is null or empty, the method will derive a source name using the calling method.
 3109    ''' </remarks>
 3003110    Public Function MaxSource(
 3003111        ByVal sourceName As String) As String
 3112
 6003113        If String.IsNullOrEmpty(sourceName) Then
 163114            sourceName = Source()
 3083115        End If
 3116
 6003117        Return sourceName.Substring(0, If(sourceName.Length > 211, 211, sourceName.Length))
 3118
 6003119    End Function
 3120
 3121    ''' <summary>
 3122    ''' Checks whether a specific source is registered to a specific event log on the specified machine.
 3123    ''' </summary>
 3124    ''' <param name="sourceName">The name of the event source.</param>
 3125    ''' <param name="logName">The name of the event log (e.g., "Application").</param>
 3126    ''' <param name="machineName">The target machine name, or "." for the local machine.</param>
 3127    ''' <returns><c>True</c> if the source is registered; otherwise, <c>False</c>.</returns>
 43128    Public Function IsSourceRegisteredToLog(
 43129            ByVal sourceName As String,
 43130            ByVal logName As String,
 43131            ByVal machineName As String) As Boolean
 3132
 83133        Dim registryPath As String = $"SYSTEM\CurrentControlSet\Services\EventLog\{logName}\{sourceName}"
 3134
 83135        Return _registryReader.SubKeyExists(RegistryHive.LocalMachine, machineName, registryPath)
 3136
 83137    End Function
 3138
 3139    ''' <summary>
 3140    ''' Checks if the current user has read access to the registry key for a specific event log source.
 3141    ''' </summary>
 3142    ''' <param name="sourceName">The name of the event source.</param>
 3143    ''' <param name="logName">The name of the event log.</param>
 3144    ''' <param name="machineName">The machine to check, or "." for local machine.</param>
 3145    ''' <returns><c>True</c> if the registry key can be read; otherwise, <c>False</c>.</returns>
 43146    Public Function CanReadRegistryForLogAndSource(
 43147            ByVal sourceName As String,
 43148            ByVal logName As String,
 43149            ByVal machineName As String) As Boolean
 3150
 83151        Dim registryPath As String = $"SYSTEM\CurrentControlSet\Services\EventLog\{logName}\{sourceName}"
 3152
 83153        Return _registryReader.HasRegistryAccess(RegistryHive.LocalMachine, machineName, registryPath, False)
 3154
 83155    End Function
 3156
 3157    ''' <summary>
 3158    ''' Determines if the current user has access (read or write) to the registry key for a given event log.
 3159    ''' </summary>
 3160    ''' <param name="logName">The name of the event log.</param>
 3161    ''' <param name="machineName">The target machine name, or "." for local machine.</param>
 3162    ''' <param name="writeAccess">Optional. <c>True</c> to check for write access; otherwise, <c>False</c> for read-only
 3163    ''' <returns><c>True</c> if access is permitted; otherwise, <c>False</c>.</returns>
 43164    Public Function CanReadRegistryForLog(
 43165            ByVal logName As String,
 43166            ByVal machineName As String,
 43167            Optional ByVal writeAccess As Boolean = False) As Boolean
 3168
 83169        Dim registryPath As String = $"SYSTEM\CurrentControlSet\Services\EventLog\{logName}"
 3170
 83171        Return _registryReader.HasRegistryAccess(RegistryHive.LocalMachine, machineName, registryPath, writeAccess)
 3172
 83173    End Function
 3174
 3175    ''' <summary>
 3176    ''' Normalizes the message.
 3177    ''' </summary>
 3178    ''' <param name="sourceName">Name of the source.</param>
 3179    ''' <param name="message">The message.</param>
 3180    ''' <returns></returns>
 1203181    Private Function NormalizeMessage(
 1203182            ByVal sourceName As String,
 1203183            ByVal message As String) As String
 3184
 2403185        Dim defaultSource As String = Source(sourceName)
 2403186        Dim finalMessage As String = If(String.IsNullOrEmpty(message), "No message provided.", message.Trim())
 4403187        If Not finalMessage.EndsWith("."c) Then finalMessage &= "."
 4803188        If Not finalMessage.StartsWith("["c) Then finalMessage = $"[{defaultSource}] {finalMessage}"
 3189
 3190        Const maxLength As Integer = 32766
 3191        Const _truncationMarker As String = "... [TRUNCATED]"
 2403192        Dim marker As String = If(String.IsNullOrEmpty(TruncationMarker), _truncationMarker, TruncationMarker)
 3193
 2403194        If finalMessage.Length > maxLength Then
 3195            ' Leave room for the truncation marker
 483196            Dim maxWithoutMarker As Integer = maxLength - marker.Length
 483197            finalMessage = $"{finalMessage.Substring(0, maxWithoutMarker)}{marker}"
 1443198        End If
 3199
 2403200        Return finalMessage
 3201
 2403202    End Function
 3203
 3204    ''' <summary>
 3205    ''' Splits the message into pages.
 3206    ''' </summary>
 3207    ''' <param name="sourceName">Name of the source.</param>
 3208    ''' <param name="message">The message.</param>
 3209    ''' <returns></returns>
 83210    Private Function SplitMessageIntoPages(
 83211        ByVal sourceName As String,
 83212        ByVal message As String) As IEnumerable(Of String)
 3213
 3214        Const maxLength As Integer = 32766
 163215        Dim defaultSource As String = Source(sourceName)
 163216        Dim baseMessage As String = message.Trim()
 323217        If Not baseMessage.EndsWith("."c) Then baseMessage &= "."
 3218
 163219        Dim cm As String = ContinuationMarker
 3220
 243221        If String.IsNullOrEmpty(cm) Then cm = " ..."
 3222
 3223        ' Initial prefix length calculation
 3224        ' Format: "[Source] [Part 999/999] "
 163225        Dim maxPartsEstimate As Integer = CInt(Math.Ceiling(baseMessage.Length / (maxLength - 50)))
 163226        Dim digitCount As Integer = maxPartsEstimate.ToString().Length + 1 ' pad by 1 digit for safety
 3227
 3228        ' Build conservative prefix sample with max digit placeholders
 163229        Dim maxPartsPlaceholder As New String("9"c, digitCount)
 163230        Dim prefixSample As String = $"[{defaultSource}] [Part {maxPartsPlaceholder}/{maxPartsPlaceholder}] "
 3231        ' Calculate the chunk size by subtracting the prefix length and the space for " ..." at the end of a chunk
 163232        Dim chunkSize As Integer = maxLength - prefixSample.Length - cm.Length
 3233
 3234        ' Now split message
 163235        Dim parts As New List(Of String)
 163236        Dim index As Integer = 0
 483237        While index < baseMessage.Length
 323238            Dim len As Integer = Math.Min(chunkSize, baseMessage.Length - index)
 323239            parts.Add(baseMessage.Substring(index, len))
 323240            index += len
 163241        End While
 3242
 3243        ' Now wrap each chunk with prefix
 163244        Dim total As Integer = parts.Count
 163245        Dim result As New List(Of String)
 163246        For i As Integer = 0 To total - 2
 163247            result.Add($"[{defaultSource}] [Part {i + 1}/{total}] {parts(i)}{cm}")
 163248        Next
 163249        result.Add($"[{defaultSource}] [Part {total}/{total}] {parts(total - 1)}")
 3250
 163251        Return result
 3252
 163253    End Function
 3254
 3255    ''' <summary>
 3256    ''' Normalizes the type of the event.
 3257    ''' </summary>
 3258    ''' <param name="eventType">Type of the event.</param>
 3259    ''' <returns></returns>
 1483260    Private Function NormalizeEventType(
 1483261            ByVal eventType As EventLogEntryType) As EventLogEntryType
 3262
 2963263        Select Case eventType
 1123264            Case EventLogEntryType.Error, EventLogEntryType.Warning, EventLogEntryType.Information
 2243265                Return eventType
 363266            Case Else
 723267                Return EventLogEntryType.Information
 3268        End Select
 3269
 2963270    End Function
 3271
 3272    ''' <summary>
 3273    ''' Normalizes the name of the machine.
 3274    ''' </summary>
 3275    ''' <param name="_machineName">Name of the machine.</param>
 3276    ''' <returns></returns>
 1323277    Private Function NormalizeMachineName(
 1323278            ByVal _machineName As String) As String
 3279
 2643280        Return If(String.IsNullOrEmpty(_machineName), If(String.IsNullOrEmpty(MachineName), ".", MachineName), _machineN
 3281
 1703282    End Function
 3283
 3284    ''' <summary>
 3285    ''' Reads an application setting by key and returns defaultValue
 3286    ''' when no setting is found or an error occurs.
 3287    ''' </summary>
 3288    ''' <param name="key">The key.</param>
 3289    ''' <param name="defaultValue">The default value.</param>
 3290    ''' <remarks>
 3291    ''' On .NET Core / .NET 5+ this method constructs and builds a <see href="ConfigurationBuilder"/>
 3292    ''' and reads <c>appsettings.json</c> each time it is invoked. During <c>InitializeConfiguration</c>
 3293    ''' this leads to the file being parsed once per recognized key. This is intentional to avoid
 3294    ''' static lifetime configuration state; if you need fewer file reads, enable caching
 3295    ''' (see caching example).
 3296    ''' </remarks>
 3297    ''' <returns>The value to be placed in the property associated with the call</returns>
 1083298    Private Function GetAppSetting(
 1083299            ByVal key As String,
 1083300            ByVal defaultValue As String) As String
 3301
 3302#If NETFRAMEWORK Then
 3303        Try
 3304            ' .NET Framework: App.config / Web.config
 3305            Dim value As String = ConfigurationManager.AppSettings(key)
 3306            If String.IsNullOrEmpty(value) Then
 3307                Return defaultValue
 3308            End If
 3309
 3310            Return value
 3311        Catch
 3312            Return defaultValue
 3313        End Try
 3314#Else
 3315        ' .NET Core / .NET 5+ : appsettings.json
 2163316        Dim builder As New ConfigurationBuilder()
 2163317        builder.SetBasePath(AppContext.BaseDirectory)
 2163318        builder.AddJsonFile("appsettings.json", optional:=True, reloadOnChange:=True)
 2163319        Dim config As IConfigurationRoot = builder.Build()
 3320
 2163321        Dim value As String = config(key)
 2163322        If String.IsNullOrEmpty(value) Then
 963323            Return defaultValue
 603324        End If
 3325
 1203326        Return value
 3327#End If
 3328
 2163329    End Function
 3330
 3331    ''' <summary>
 3332    ''' Gets the application setting.
 3333    ''' </summary>
 3334    ''' <param name="key">The key.</param>
 3335    ''' <param name="defaultValue">The default value.</param>
 3336    ''' <returns></returns>
 243337    Private Function GetAppSetting(
 243338            ByVal key As String,
 243339            ByVal defaultValue As Integer) As Integer
 3340
 483341        Dim raw As String = GetAppSetting(key, defaultValue.ToString())
 3342
 3343        Dim result As Integer
 483344        Return If(Integer.TryParse(raw, result), result, defaultValue)
 3345
 363346    End Function
 3347
 3348    ''' <summary>
 3349    ''' Gets the application setting.
 3350    ''' </summary>
 3351    ''' <param name="key">The key.</param>
 3352    ''' <param name="defaultValue">if set to <c>true</c> default value.</param>
 3353    ''' <returns></returns>
 243354    Private Function GetAppSetting(
 243355            ByVal key As String,
 243356            ByVal defaultValue As Boolean) As Boolean
 3357
 483358        Dim raw As String = GetAppSetting(key, defaultValue.ToString())
 3359
 3360        Dim result As Boolean
 483361        Return If(Boolean.TryParse(raw, result), result, defaultValue)
 3362
 363363    End Function
 3364
 3365#End Region
 3366
 3367#Region " GetLog routines ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
 3368
 3369    ''' <summary>
 3370    ''' Gets the entry log class to use for writing to the event log.
 3371    ''' </summary>
 3372    ''' <returns></returns>
 43373    Public Function GetLog() As EventLog
 3374
 83375        Initialize()
 3376
 83377        Return GetLog(
 83378            SourceName)
 3379
 83380    End Function
 3381
 3382    ''' <summary>
 3383    ''' Gets the entry log class to use for writing to the event log.
 3384    ''' </summary>
 3385    ''' <param name="sourceName">
 3386    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 3387    ''' generated using the calling method's namespace, class, and method name.
 3388    ''' If the source exceeds 254 characters, it is automatically truncated.
 3389    ''' </param>
 3390    ''' <returns></returns>
 43391    Public Function GetLog(
 43392            ByVal sourceName As String) As EventLog
 3393
 83394        Initialize()
 3395
 83396        Return GetLog(
 83397            LogName,
 83398            sourceName)
 3399
 83400    End Function
 3401
 3402    ''' <summary>
 3403    ''' Gets the entry log class to use for writing to the event log.
 3404    ''' </summary>
 3405    ''' <param name="logName">
 3406    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 3407    ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used.
 3408    ''' </param>
 3409    ''' <param name="sourceName">
 3410    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 3411    ''' generated using the calling method's namespace, class, and method name.
 3412    ''' If the source exceeds 254 characters, it is automatically truncated.
 3413    ''' </param>
 3414    ''' <returns></returns>
 283415    Public Function GetLog(
 283416            ByVal logName As String,
 283417            ByVal sourceName As String) As EventLog
 3418
 563419        Initialize()
 3420
 563421        Return GetLog(
 563422            logName,
 563423            sourceName,
 563424            MaxKilobytes,
 563425            RetentionDays)
 3426
 563427    End Function
 3428
 3429    ''' <summary>
 3430    ''' Gets the entry log class to use for writing to the event log.
 3431    ''' </summary>
 3432    ''' <param name="logName">
 3433    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 3434    ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used.
 3435    ''' </param>
 3436    ''' <param name="sourceName">
 3437    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 3438    ''' generated using the calling method's namespace, class, and method name.
 3439    ''' If the source exceeds 254 characters, it is automatically truncated.
 3440    ''' </param>
 3441    ''' <param name="maxKilobytes">
 3442    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3443    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3444    ''' </param>
 3445    ''' <param name="retentionDays">
 3446    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3447    ''' Only used when creating a new log.
 3448    ''' </param>
 3449    ''' <returns></returns>
 283450    Public Function GetLog(
 283451            ByVal logName As String,
 283452            ByVal sourceName As String,
 283453            ByVal maxKilobytes As Integer,
 283454            ByVal retentionDays As Integer) As EventLog
 3455
 563456        Initialize()
 3457
 563458        Return GetLog(
 563459            logName,
 563460            sourceName,
 563461            maxKilobytes,
 563462            retentionDays,
 563463            WriteInitEntry)
 3464
 563465    End Function
 3466
 3467    ''' <summary>
 3468    ''' Gets the entry log class to use for writing to the event log.
 3469    ''' </summary>
 3470    ''' <param name="logName">
 3471    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 3472    ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used.
 3473    ''' </param>
 3474    ''' <param name="sourceName">
 3475    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 3476    ''' generated using the calling method's namespace, class, and method name.
 3477    ''' If the source exceeds 254 characters, it is automatically truncated.
 3478    ''' </param>
 3479    ''' <param name="maxKilobytes">
 3480    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3481    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3482    ''' </param>
 3483    ''' <param name="retentionDays">
 3484    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3485    ''' Only used when creating a new log.
 3486    ''' </param>
 3487    ''' <param name="writeInitEntry">
 3488    ''' Indicates whether an initialization entry should be written when a new log is created.
 3489    ''' </param>
 3490    ''' <returns></returns>
 283491    Public Function GetLog(
 283492            ByVal logName As String,
 283493            ByVal sourceName As String,
 283494            ByVal maxKilobytes As Integer,
 283495            ByVal retentionDays As Integer,
 283496            ByVal writeInitEntry As Boolean) As EventLog
 3497
 563498        Initialize()
 3499
 563500        Return GetLog(
 563501            MachineName,
 563502            logName,
 563503            sourceName,
 563504            maxKilobytes,
 563505            retentionDays,
 563506            writeInitEntry)
 3507
 563508    End Function
 3509
 3510    ''' <summary>
 3511    ''' Gets the entry log class to use for writing to the event log.
 3512    ''' </summary>
 3513    ''' <param name="machineName">
 3514    ''' The name of the machine where the event log resides. Use <c>"."</c> to refer to the local machine.
 3515    ''' If <c>null</c> or empty, the local machine is used by default, or the value in <c>MachinName</c> if set.
 3516    ''' </param>
 3517    ''' <param name="logName">
 3518    ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name).
 3519    ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used.
 3520    ''' </param>
 3521    ''' <param name="sourceName">
 3522    ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically
 3523    ''' generated using the calling method's namespace, class, and method name.
 3524    ''' If the source exceeds 254 characters, it is automatically truncated.
 3525    ''' </param>
 3526    ''' <param name="maxKilobytes">
 3527    ''' The maximum size of the event log in kilobytes. Only used when creating a new log.
 3528    ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used.
 3529    ''' </param>
 3530    ''' <param name="retentionDays">
 3531    ''' The number of days to retain event log entries. If 0, events are retained indefinitely.
 3532    ''' Only used when creating a new log.
 3533    ''' </param>
 3534    ''' <param name="writeInitEntry">
 3535    ''' Indicates whether an initialization entry should be written when a new log is created.
 3536    ''' </param>
 3537    ''' <returns></returns>
 283538    Public Function GetLog(
 283539            ByVal machineName As String,
 283540            ByVal logName As String,
 283541            ByVal sourceName As String,
 283542            ByVal maxKilobytes As Integer,
 283543            ByVal retentionDays As Integer,
 283544            ByVal writeInitEntry As Boolean) As EventLog
 3545
 563546        Initialize()
 3547
 563548        Return _writer.GetLog(
 563549            NormalizeMachineName(machineName),
 563550            logName,
 563551            sourceName,
 563552            maxKilobytes,
 563553            retentionDays,
 563554            writeInitEntry)
 3555
 563556    End Function
 3557
 3558#End Region
 3559
 3560End Module

Methods/Properties

.cctor()
SetWriter(EventLogHelper.IEventLogWriter)
SetWriter(EventLogHelper.IEventLogWriter)
SetRegistryReader(EventLogHelper.IRegistryReader)
SetRegistryReader(EventLogHelper.IRegistryReader)
Initialize()
Initialize()
InitializeConfiguration()
InitializeConfiguration()
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()
Log(System.String)
Log(System.String)
Log(System.String,System.String)
Log(System.String,System.String)
Log(System.String,System.Diagnostics.EventLogEntryType)
Log(System.String,System.Diagnostics.EventLogEntryType)
Log(System.String,System.String,System.String)
Log(System.String,System.String,System.String)
Log(System.String,System.String,System.Diagnostics.EventLogEntryType)
Log(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)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32)
Log(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)
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.Diagnostics.EventLogEntryType,System.Int32,System.Int16)
Log(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)
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.Byte[])
Log(System.String,System.Byte[])
Log(System.String,System.Diagnostics.EventLogEntryType,System.Byte[])
Log(System.String,System.Diagnostics.EventLogEntryType,System.Byte[])
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.Int16,System.Byte[])
Log(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[])
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.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[],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.Int32,System.Int32)
Log(System.String,System.Int32,System.Int32)
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,System.Int32)
Log(System.String,System.Diagnostics.EventLogEntryType,System.Int32,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)
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.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.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.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.Int32,System.Int32,System.Boolean)
Log(System.String,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)
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.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.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.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.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.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)
LogEntry(System.Diagnostics.EventLog,System.String)
LogEntry(System.Diagnostics.EventLog,System.String)
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.Int32)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int32)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int16)
LogEntry(System.Diagnostics.EventLog,System.String,System.Int16)
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.Int16)
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,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)
LogEntry(System.Diagnostics.EventLog,System.String,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Byte[])
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.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.Int16,System.Byte[])
LogEntry(System.Diagnostics.EventLog,System.String,System.Diagnostics.EventLogEntryType,System.Int32,System.Int16,System.Byte[])
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)
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)