| | 1 | | Imports Microsoft.Win32 |
| | 2 | | Imports System.Reflection |
| | 3 | | Imports System.Runtime.CompilerServices |
| | 4 | | Imports EventLogHelper.Enums |
| | 5 | | Imports EventLogHelper.Interfaces |
| | 6 | | Imports System.Globalization |
| | 7 | |
|
| | 8 | | #If NETFRAMEWORK Then |
| | 9 | | Imports System.Configuration |
| | 10 | | #Else |
| | 11 | | Imports System.IO |
| | 12 | | Imports Microsoft.Extensions.Configuration |
| | 13 | | #End If |
| | 14 | |
|
| | 15 | | ''' <summary> |
| | 16 | | ''' Provides high-level utilities for logging to the Windows Event Log in a simplified and customizable way. |
| | 17 | | ''' </summary><remarks> |
| | 18 | | ''' <para> |
| | 19 | | ''' This module abstracts common patterns for writing entries to the Windows Event Log. It simplifies usage by handling: |
| | 20 | | ''' </para> |
| | 21 | | ''' <list type="bullet"> |
| | 22 | | ''' <item>Automatic validation and creation of logs and sources.</item> |
| | 23 | | ''' <item>Falls back when <c>log</c> or <c>source</c> parameters are not provided.</item> |
| | 24 | | ''' <item>Automatic source naming based on the calling method and class context.</item> |
| | 25 | | ''' <item>Safe handling and truncation of long messages to comply with system limits.</item> |
| | 26 | | ''' </list> |
| | 27 | | ''' <para> |
| | 28 | | ''' The default event log is <c>Application</c>. If no source is provided, a fully qualified method name |
| | 29 | | ''' (including namespace and class) is used as the source identifier. |
| | 30 | | ''' </para> |
| | 31 | | ''' <para> |
| | 32 | | ''' This module is suitable for both production use (via <see cref="RealEventLogWriter" />) and unit testing |
| | 33 | | ''' (via a test implementation such as <c>EventLogHelper.Tests.TestEventLogWriter</c> in a separate test project). |
| | 34 | | ''' </para> |
| | 35 | | ''' </remarks> |
| | 36 | | Public Module SmartEventLogger |
| | 37 | |
|
| | 38 | | #Region " Process Support Objects ^^^^^^^^^^^^^^^^^^^^^^^^^ " |
| | 39 | |
|
| | 40 | | ''' <summary> |
| | 41 | | ''' The current event log writer instance used by the logger. |
| | 42 | | ''' </summary> |
| | 43 | | ''' <remarks> |
| | 44 | | ''' By default, this is initialized to an instance of <see cref="RealEventLogWriter"/>, which writes to the actual |
| | 45 | | ''' Windows Event Log. This field is typically replaced during testing with a mock or stub implementation via the |
| | 46 | | ''' <see cref="SetWriter"/> method. |
| | 47 | | ''' </remarks> |
| 8 | 48 | | Private _writer As IEventLogWriter = New RealEventLogWriter() |
| | 49 | | ''' <summary> |
| | 50 | | ''' The registry reader |
| | 51 | | ''' </summary> |
| 8 | 52 | | Private _registryReader As IRegistryReader = New RealRegistryReader() |
| | 53 | |
|
| | 54 | | ''' <summary> |
| | 55 | | ''' Sets the <see cref="IEventLogWriter"/> implementation used for logging operations. |
| | 56 | | ''' </summary> |
| | 57 | | ''' <param name="writer"> |
| | 58 | | ''' The custom writer instance to use. This allows swapping out the default <see cref="RealEventLogWriter"/> |
| | 59 | | ''' for testing or alternate logging implementations. |
| | 60 | | ''' </param> |
| | 61 | | ''' <remarks> |
| | 62 | | ''' This method is primarily intended for use in unit tests or advanced scenarios where log output should be redirec |
| | 63 | | ''' or suppressed. For example, a test implementation may capture and inspect log data without writing to the real e |
| | 64 | | ''' </remarks> |
| 236 | 65 | | Public Sub SetWriter(writer As IEventLogWriter) |
| | 66 | |
|
| 472 | 67 | | _writer = writer |
| | 68 | |
|
| 472 | 69 | | End Sub |
| | 70 | |
|
| | 71 | | ''' <summary> |
| | 72 | | ''' Specifies the <see cref="IRegistryReader"/> implementation to use when accessing |
| | 73 | | ''' the Windows Registry for log-related operations (e.g., determining default event log sources). |
| | 74 | | ''' </summary> |
| | 75 | | ''' <param name="reader"> |
| | 76 | | ''' The custom <see cref="IRegistryReader"/> instance to use. This is typically used for unit testing |
| | 77 | | ''' or customizing how registry access is performed. If not set, the default implementation will be used. |
| | 78 | | ''' </param> |
| | 79 | | ''' <remarks> |
| | 80 | | ''' This method allows injection of a mock or testable registry reader. In production, |
| | 81 | | ''' a default <c>RealRegistryReader</c> is used, but in unit tests, you may inject a fake |
| | 82 | | ''' reader to simulate different registry states without accessing the actual system registry. |
| | 83 | | ''' </remarks> |
| 48 | 84 | | Public Sub SetRegistryReader(reader As IRegistryReader) |
| | 85 | |
|
| 96 | 86 | | _registryReader = reader |
| | 87 | |
|
| 96 | 88 | | End Sub |
| | 89 | |
|
| | 90 | | #End Region |
| | 91 | |
|
| | 92 | | #Region " Initialization ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
| | 93 | |
|
| | 94 | | ''' <summary> |
| | 95 | | ''' Has the Initialization process happened? |
| | 96 | | ''' This is used to prevent multiple initializations. |
| | 97 | | ''' </summary> |
| | 98 | | Private _isInitialized As Boolean |
| | 99 | |
|
| | 100 | | ''' <summary> |
| | 101 | | ''' is initializing |
| | 102 | | ''' </summary> |
| | 103 | | Private _isInitializing As Boolean |
| | 104 | |
|
| | 105 | | ''' <summary> |
| | 106 | | ''' The initialization lock |
| | 107 | | ''' </summary> |
| 8 | 108 | | Private ReadOnly _initLock As New Object() |
| | 109 | |
|
| | 110 | | ''' <summary> |
| | 111 | | ''' Initializes this instance. |
| | 112 | | ''' </summary> |
| 10340 | 113 | | Private Sub Initialize() |
| | 114 | |
|
| 30768 | 115 | | If _isInitialized OrElse _isInitializing Then Return |
| 504 | 116 | | _isInitializing = True |
| 756 | 117 | | SyncLock _initLock |
| 252 | 118 | | Try |
| 504 | 119 | | If Not _isInitialized Then |
| 504 | 120 | | MachineName = GetAppSetting("EventLogHelper.MachineName", MachineName) |
| 504 | 121 | | LogName = GetAppSetting("EventLogHelper.LogName", LogName) |
| 504 | 122 | | SourceName = GetAppSetting("EventLogHelper.SourceName", SourceName) |
| 504 | 123 | | MaxKilobytes = GetAppSetting("EventLogHelper.MaxKilobytes", MaxKilobytes) |
| 504 | 124 | | RetentionDays = GetAppSetting("EventLogHelper.RetentionDays", RetentionDays) |
| 504 | 125 | | WriteInitEntry = GetAppSetting("EventLogHelper.WriteInitEntry", WriteInitEntry) |
| 504 | 126 | | TruncationMarker = GetAppSetting("EventLogHelper.TruncationMarker", TruncationMarker) |
| 504 | 127 | | ContinuationMarker = GetAppSetting("EventLogHelper.ContinuationMarker", ContinuationMarker) |
| 504 | 128 | | AllowMultiEntryMessages = GetAppSetting("EventLogHelper.AllowMultiEntryMessages", AllowMultiEntryMes |
| 504 | 129 | | IncludeSourceInMessage = GetAppSetting("EventLogHelper.IncludeSourceInMessage", IncludeSourceInMessa |
| 504 | 130 | | CurrentLoggingLevel = GetAppSetting("EventLogHelper.CurrentLoggingLevel", CurrentLoggingLevel) |
| 504 | 131 | | LoggingSeverity = GetAppSetting("EventLogHelper.LoggingSeverity", LoggingSeverity) |
| 504 | 132 | | SourceResolutionBehavior = GetAppSetting("EventLogHelper.SourceResolutionBehavior", SourceResolution |
| | 133 | |
|
| 504 | 134 | | _isInitialized = True |
| 756 | 135 | | End If |
| 252 | 136 | | Finally |
| 504 | 137 | | _isInitializing = False |
| 252 | 138 | | End Try |
| 756 | 139 | | End SyncLock |
| | 140 | |
|
| 20680 | 141 | | End Sub |
| | 142 | |
|
| | 143 | | ''' <summary> |
| | 144 | | ''' Reads configuration values from <c>App.config</c>, <c>Web.config</c>, or |
| | 145 | | ''' <c>appsettings.json</c> (depending on the target framework) and applies |
| | 146 | | ''' them to <see cref="SmartEventLogger"/> defaults. |
| | 147 | | ''' </summary> |
| | 148 | | ''' <remarks> |
| | 149 | | ''' <para> |
| | 150 | | ''' This method reads predefined settings from the application's configuration and |
| | 151 | | ''' applies them to the corresponding <see cref="SmartEventLogger"/> properties. |
| | 152 | | ''' If a configuration value is not found, the property's existing value is retained. |
| | 153 | | ''' </para> |
| | 154 | | ''' <para> |
| | 155 | | ''' Calling this method explicitly is optional. Configuration will also be loaded |
| | 156 | | ''' automatically the first time a public method or property is accessed, unless it |
| | 157 | | ''' has already been initialized. |
| | 158 | | ''' </para> |
| | 159 | | ''' <para> |
| | 160 | | ''' Thread-safe: Initialization is guaranteed to run only once, even if called |
| | 161 | | ''' concurrently from multiple threads. |
| | 162 | | ''' </para> |
| | 163 | | ''' |
| | 164 | | ''' <para> |
| | 165 | | ''' Recognized configuration keys: |
| | 166 | | ''' </para> |
| | 167 | | ''' <list type="table"> |
| | 168 | | ''' <listheader> |
| | 169 | | ''' <term>Key</term> |
| | 170 | | ''' <description>Description</description> |
| | 171 | | ''' </listheader> |
| | 172 | | ''' |
| | 173 | | ''' <item> |
| | 174 | | ''' <term>EventLogHelper.MachineName</term> |
| | 175 | | ''' <description> |
| | 176 | | ''' The name of the machine where the event log resides. Use <c>"."</c> for the local machine. |
| | 177 | | ''' Defaults to the current value of <see cref="MachineName"/> (normally "."). |
| | 178 | | ''' </description> |
| | 179 | | ''' </item> |
| | 180 | | ''' |
| | 181 | | ''' <item> |
| | 182 | | ''' <term>EventLogHelper.LogName</term> |
| | 183 | | ''' <description> |
| | 184 | | ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log). |
| | 185 | | ''' Defaults to the current value of <see cref="LogName"/> (normally "Application"). |
| | 186 | | ''' </description> |
| | 187 | | ''' </item> |
| | 188 | | ''' |
| | 189 | | ''' <item> |
| | 190 | | ''' <term>EventLogHelper.SourceName</term> |
| | 191 | | ''' <description> |
| | 192 | | ''' The event source name associated with log entries. If not provided, a name is automatically |
| | 193 | | ''' generated from the calling method's namespace, class, and method name. Defaults to |
| | 194 | | ''' the current value of <see cref="SourceName"/>. |
| | 195 | | ''' </description> |
| | 196 | | ''' </item> |
| | 197 | | ''' |
| | 198 | | ''' <item> |
| | 199 | | ''' <term>EventLogHelper.MaxKilobytes</term> |
| | 200 | | ''' <description> |
| | 201 | | ''' The maximum size of the event log in kilobytes when creating a new log. |
| | 202 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 203 | | ''' Defaults to the current value of <see cref="MaxKilobytes"/> (normally 0). |
| | 204 | | ''' </description> |
| | 205 | | ''' </item> |
| | 206 | | ''' |
| | 207 | | ''' <item> |
| | 208 | | ''' <term>EventLogHelper.RetentionDays</term> |
| | 209 | | ''' <description> |
| | 210 | | ''' The number of days to retain event log entries when creating a new log. |
| | 211 | | ''' If 0, events are retained indefinitely. |
| | 212 | | ''' Defaults to the current value of <see cref="RetentionDays"/> (normally 0). |
| | 213 | | ''' </description> |
| | 214 | | ''' </item> |
| | 215 | | ''' |
| | 216 | | ''' <item> |
| | 217 | | ''' <term>EventLogHelper.WriteInitEntry</term> |
| | 218 | | ''' <description> |
| | 219 | | ''' Indicates whether to write an initialization entry to the log when a new log is created. |
| | 220 | | ''' Defaults to the current value of <see cref="WriteInitEntry"/> (normally True). |
| | 221 | | ''' </description> |
| | 222 | | ''' </item> |
| | 223 | | ''' |
| | 224 | | ''' <item> |
| | 225 | | ''' <term>EventLogHelper.TruncationMarker</term> |
| | 226 | | ''' <description> |
| | 227 | | ''' The string appended to messages that are truncated due to exceeding the 32,766-character limit. |
| | 228 | | ''' Defaults to the current value of <see cref="TruncationMarker"/> (normally "... [TRUNCATED]"). |
| | 229 | | ''' </description> |
| | 230 | | ''' </item> |
| | 231 | | ''' |
| | 232 | | ''' <item> |
| | 233 | | ''' <term>EventLogHelper.ContinuationMarker</term> |
| | 234 | | ''' <description> |
| | 235 | | ''' The string appended to all but the last chunk of a message when multi-entry logging is enabled. |
| | 236 | | ''' Defaults to the current value of <see cref="ContinuationMarker"/> (normally " ..."). |
| | 237 | | ''' </description> |
| | 238 | | ''' </item> |
| | 239 | | ''' |
| | 240 | | ''' <item> |
| | 241 | | ''' <term>EventLogHelper.AllowMultiEntryMessages</term> |
| | 242 | | ''' <description> |
| | 243 | | ''' Indicates whether messages longer than 32,766 characters should be split into multiple |
| | 244 | | ''' sequential entries instead of being truncated. Defaults to the current value of |
| | 245 | | ''' <see cref="AllowMultiEntryMessages"/> (normally False). |
| | 246 | | ''' </description> |
| | 247 | | ''' </item> |
| | 248 | | ''' |
| | 249 | | ''' </list> |
| | 250 | | ''' </remarks> |
| 8 | 251 | | Public Sub InitializeConfiguration() |
| | 252 | |
|
| 16 | 253 | | Initialize() |
| | 254 | |
|
| 16 | 255 | | End Sub |
| | 256 | |
|
| | 257 | | ''' <summary> |
| | 258 | | ''' Resets this instance. |
| | 259 | | ''' </summary> |
| 296 | 260 | | Friend Sub Reset() |
| | 261 | |
|
| | 262 | | ' Reset all configuration settings to their default values |
| 592 | 263 | | _machineName = "." |
| 592 | 264 | | _logName = "Application" |
| 592 | 265 | | _sourceName = "" |
| 592 | 266 | | _maxKilobytes = 1024 * 1024 |
| 592 | 267 | | _retentionDays = 7 |
| 592 | 268 | | _writeInitEntry = False |
| 592 | 269 | | _IncludeSourceInMessage = True |
| 592 | 270 | | _truncationMarker = "... [TRUNCATED]" |
| 592 | 271 | | _continuationMarker = " ..." |
| 592 | 272 | | _allowMultiEntryMessages = False |
| 592 | 273 | | _CurrentLoggingLevel = LoggingLevel.Verbose |
| 592 | 274 | | _LoggingSeverity = LoggingSeverity.Info |
| 592 | 275 | | _sourceResolutionBehavior = SourceResolutionBehavior.Strict |
| 592 | 276 | | _writer = New RealEventLogWriter() |
| 592 | 277 | | _registryReader = New RealRegistryReader() |
| 592 | 278 | | FileSystem = New RealFileSystemShim() |
| 592 | 279 | | Config = New RealConfigShim() |
| 592 | 280 | | JsonSettingsFile = "appsettings.json" |
| 592 | 281 | | _isInitialized = False |
| 592 | 282 | | _isInitializing = False |
| | 283 | |
|
| 592 | 284 | | End Sub |
| | 285 | |
|
| | 286 | | #End Region |
| | 287 | |
|
| | 288 | | #Region " Backing Fields ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
| | 289 | |
|
| | 290 | | ''' <summary> |
| | 291 | | ''' The machine name |
| | 292 | | ''' </summary> |
| 8 | 293 | | Private _machineName As String = "." |
| | 294 | | ''' <summary> |
| | 295 | | ''' The log name |
| | 296 | | ''' </summary> |
| 8 | 297 | | Private _logName As String = "Application" |
| | 298 | | ''' <summary> |
| | 299 | | ''' The source name |
| | 300 | | ''' </summary> |
| 8 | 301 | | Private _sourceName As String = "" |
| | 302 | | ''' <summary> |
| | 303 | | ''' The maximum kilobytes |
| | 304 | | ''' </summary> |
| 8 | 305 | | Private _maxKilobytes As Integer = 1024 * 1024 |
| | 306 | | ''' <summary> |
| | 307 | | ''' The retention days |
| | 308 | | ''' </summary> |
| 8 | 309 | | Private _retentionDays As Integer = 7 |
| | 310 | | ''' <summary> |
| | 311 | | ''' The write initialize entry |
| | 312 | | ''' </summary> |
| | 313 | | Private _writeInitEntry As Boolean |
| | 314 | | ''' <summary> |
| | 315 | | ''' The truncation marker |
| | 316 | | ''' </summary> |
| 8 | 317 | | Private _truncationMarker As String = "... [TRUNCATED]" |
| | 318 | | ''' <summary> |
| | 319 | | ''' The continuation marker |
| | 320 | | ''' </summary> |
| 8 | 321 | | Private _continuationMarker As String = " ..." |
| | 322 | | ''' <summary> |
| | 323 | | ''' The allow multi entry messages |
| | 324 | | ''' </summary> |
| | 325 | | Private _allowMultiEntryMessages As Boolean |
| | 326 | | ''' <summary> |
| | 327 | | ''' include the source in message |
| | 328 | | ''' </summary> |
| 8 | 329 | | Private _IncludeSourceInMessage As Boolean = True |
| | 330 | | ''' <summary> |
| | 331 | | ''' The current logging level |
| | 332 | | ''' </summary> |
| 8 | 333 | | Private _CurrentLoggingLevel As LoggingLevel = LoggingLevel.Verbose |
| | 334 | | ''' <summary> |
| | 335 | | ''' The logging severity |
| | 336 | | ''' </summary> |
| 8 | 337 | | Private _LoggingSeverity As LoggingSeverity = LoggingSeverity.Info |
| | 338 | | ''' <summary> |
| | 339 | | ''' the source resolution behavior. |
| | 340 | | ''' </summary> |
| 8 | 341 | | Private _sourceResolutionBehavior As SourceResolutionBehavior = SourceResolutionBehavior.Strict |
| | 342 | |
|
| | 343 | | #End Region |
| | 344 | |
|
| | 345 | | #Region " Default Value Properties ^^^^^^^^^^^^^^^^^^^^^^^^ " |
| | 346 | |
|
| | 347 | | ''' <summary> |
| | 348 | | ''' Gets or sets the name of the machine where log entries will be written. |
| | 349 | | ''' </summary> |
| | 350 | | ''' <value> |
| | 351 | | ''' A string representing the machine name. Use <c>"."</c> for the local machine. |
| | 352 | | ''' </value> |
| | 353 | | Public Property MachineName As String |
| | 354 | |
|
| 652 | 355 | | Get |
| | 356 | |
|
| 1304 | 357 | | Initialize() |
| 1304 | 358 | | Return _machineName |
| | 359 | |
|
| 1304 | 360 | | End Get |
| 280 | 361 | | Set |
| | 362 | |
|
| 560 | 363 | | Initialize() |
| 560 | 364 | | _machineName = Value |
| | 365 | |
|
| 560 | 366 | | End Set |
| | 367 | |
|
| | 368 | | End Property |
| | 369 | |
|
| | 370 | | ''' <summary> |
| | 371 | | ''' Gets or sets the name of the Windows Event Log to write to (e.g., "Application", "System"). |
| | 372 | | ''' </summary> |
| | 373 | | ''' <value> |
| | 374 | | ''' A string specifying the log name. Defaults to <c>"Application"</c>. |
| | 375 | | ''' </value> |
| | 376 | | Public Property LogName As String |
| | 377 | |
|
| 436 | 378 | | Get |
| | 379 | |
|
| 872 | 380 | | Initialize() |
| 872 | 381 | | Return _logName |
| | 382 | |
|
| 872 | 383 | | End Get |
| 256 | 384 | | Set |
| | 385 | |
|
| 512 | 386 | | Initialize() |
| 512 | 387 | | _logName = Value |
| | 388 | |
|
| 512 | 389 | | End Set |
| | 390 | |
|
| | 391 | | End Property |
| | 392 | |
|
| | 393 | | ''' <summary> |
| | 394 | | ''' Gets or sets the name of the event source associated with log entries. |
| | 395 | | ''' </summary> |
| | 396 | | ''' <value> |
| | 397 | | ''' A string representing the source name. If not set, a source is inferred automatically using the calling method's |
| | 398 | | ''' </value> |
| | 399 | | Public Property SourceName As String |
| | 400 | |
|
| 400 | 401 | | Get |
| | 402 | |
|
| 800 | 403 | | Initialize() |
| 800 | 404 | | Return _sourceName |
| | 405 | |
|
| 800 | 406 | | End Get |
| 268 | 407 | | Set |
| | 408 | |
|
| 536 | 409 | | Initialize() |
| 536 | 410 | | _sourceName = Value |
| | 411 | |
|
| 536 | 412 | | End Set |
| | 413 | |
|
| | 414 | | End Property |
| | 415 | |
|
| | 416 | | ''' <summary> |
| | 417 | | ''' Gets or sets the maximum allowed size of the event log in kilobytes. |
| | 418 | | ''' </summary> |
| | 419 | | ''' <value> |
| | 420 | | ''' An integer representing the size in kilobytes. Defaults to <c>1,048,576</c> (1 GB). |
| | 421 | | ''' </value> |
| | 422 | | ''' <remarks> |
| | 423 | | ''' Applies only when creating or configuring new custom logs. May require administrative privileges. |
| | 424 | | ''' </remarks> |
| | 425 | | Public Property MaxKilobytes As Integer |
| | 426 | |
|
| 472 | 427 | | Get |
| | 428 | |
|
| 944 | 429 | | Initialize() |
| 944 | 430 | | Return _maxKilobytes |
| | 431 | |
|
| 944 | 432 | | End Get |
| 256 | 433 | | Set |
| | 434 | |
|
| 512 | 435 | | Initialize() |
| 512 | 436 | | _maxKilobytes = Value |
| | 437 | |
|
| 512 | 438 | | End Set |
| | 439 | |
|
| | 440 | | End Property |
| | 441 | |
|
| | 442 | | ''' <summary> |
| | 443 | | ''' Gets or sets the number of days event entries are retained before being overwritten. |
| | 444 | | ''' </summary> |
| | 445 | | ''' <value> |
| | 446 | | ''' An integer representing the retention duration in days. Defaults to <c>7</c>. |
| | 447 | | ''' </value> |
| | 448 | | ''' <remarks> |
| | 449 | | ''' Used when initializing a new event log. May be ignored depending on overflow policy or system restrictions. |
| | 450 | | ''' </remarks> |
| | 451 | | Public Property RetentionDays As Integer |
| | 452 | |
|
| 476 | 453 | | Get |
| | 454 | |
|
| 952 | 455 | | Initialize() |
| 952 | 456 | | Return _retentionDays |
| | 457 | |
|
| 952 | 458 | | End Get |
| 256 | 459 | | Set |
| | 460 | |
|
| 512 | 461 | | Initialize() |
| 512 | 462 | | _retentionDays = Value |
| | 463 | |
|
| 512 | 464 | | End Set |
| | 465 | |
|
| | 466 | | End Property |
| | 467 | |
|
| | 468 | | ''' <summary> |
| | 469 | | ''' Gets or sets a value indicating whether an informational entry should be written when a new log is created. |
| | 470 | | ''' </summary> |
| | 471 | | ''' <value> |
| | 472 | | ''' <c>True</c> to log an initialization message; otherwise, <c>False</c>. Defaults to <c>False</c>. |
| | 473 | | ''' </value> |
| | 474 | | Public Property WriteInitEntry As Boolean |
| | 475 | |
|
| 484 | 476 | | Get |
| | 477 | |
|
| 968 | 478 | | Initialize() |
| 968 | 479 | | Return _writeInitEntry |
| | 480 | |
|
| 968 | 481 | | End Get |
| 256 | 482 | | Set |
| | 483 | |
|
| 512 | 484 | | Initialize() |
| 512 | 485 | | _writeInitEntry = Value |
| | 486 | |
|
| 512 | 487 | | End Set |
| | 488 | |
|
| | 489 | | End Property |
| | 490 | |
|
| | 491 | | ''' <summary> |
| | 492 | | ''' Gets or sets the marker text used when a message is too long and must be truncated. |
| | 493 | | ''' </summary> |
| | 494 | | ''' <value> |
| | 495 | | ''' A string appended to truncated log entries. Defaults to <c>"... [TRUNCATED]"</c>. |
| | 496 | | ''' </value> |
| | 497 | | Public Property TruncationMarker As String |
| | 498 | |
|
| 668 | 499 | | Get |
| | 500 | |
|
| 1336 | 501 | | Initialize() |
| 1336 | 502 | | Return _truncationMarker |
| | 503 | |
|
| 1336 | 504 | | End Get |
| 260 | 505 | | Set |
| | 506 | |
|
| 520 | 507 | | Initialize() |
| 520 | 508 | | _truncationMarker = Value |
| | 509 | |
|
| 520 | 510 | | End Set |
| | 511 | |
|
| | 512 | | End Property |
| | 513 | |
|
| | 514 | | ''' <summary> |
| | 515 | | ''' Gets or sets the continuation marker used when splitting long messages |
| | 516 | | ''' across multiple event log entries. |
| | 517 | | ''' </summary> |
| | 518 | | ''' <value> |
| | 519 | | ''' The string appended to each intermediate log entry when |
| | 520 | | ''' <see cref="AllowMultiEntryMessages"/> is <c>true</c>. |
| | 521 | | ''' Defaults to <c>" ..."</c>. |
| | 522 | | ''' This value is ignored if message splitting is disabled. |
| | 523 | | ''' </value> |
| | 524 | | ''' <remarks> |
| | 525 | | ''' The marker is added to all chunks except the final one to indicate the |
| | 526 | | ''' message continues in the next log entry. Make sure the marker is short |
| | 527 | | ''' enough to allow meaningful message content within the 32,766-character |
| | 528 | | ''' limit of the Event Log. |
| | 529 | | ''' </remarks> |
| | 530 | | Public Property ContinuationMarker As String |
| | 531 | |
|
| 264 | 532 | | Get |
| | 533 | |
|
| 528 | 534 | | Initialize() |
| 528 | 535 | | Return _continuationMarker |
| | 536 | |
|
| 528 | 537 | | End Get |
| 264 | 538 | | Set |
| | 539 | |
|
| 528 | 540 | | Initialize() |
| 528 | 541 | | _continuationMarker = Value |
| | 542 | |
|
| 528 | 543 | | End Set |
| | 544 | |
|
| | 545 | | End Property |
| | 546 | |
|
| | 547 | | ''' <summary> |
| | 548 | | ''' Gets or sets a value indicating whether messages that exceed the Event Log |
| | 549 | | ''' length limit should be split across multiple entries. |
| | 550 | | ''' </summary> |
| | 551 | | ''' <value> |
| | 552 | | ''' <c>true</c> to split long messages into multiple event log entries; |
| | 553 | | ''' <c>false</c> to truncate long messages and append a truncation notice. |
| | 554 | | ''' Default is <c>false</c>. |
| | 555 | | ''' </value> |
| | 556 | | ''' <remarks> |
| | 557 | | ''' When enabled, messages exceeding 32,766 characters are split into sequential entries, |
| | 558 | | ''' each prefixed with a part number and optionally suffixed with a continuation marker |
| | 559 | | ''' (see <see cref="ContinuationMarker"/>). This preserves the full message without truncation. |
| | 560 | | ''' |
| | 561 | | ''' When disabled, long messages are truncated to fit within the Event Log limit, |
| | 562 | | ''' and the truncation marker (e.g., <c>"... [TRUNCATED]"</c>) is appended. |
| | 563 | | ''' </remarks> |
| | 564 | | Public Property AllowMultiEntryMessages As Boolean |
| | 565 | |
|
| 476 | 566 | | Get |
| | 567 | |
|
| 952 | 568 | | Initialize() |
| 952 | 569 | | Return _allowMultiEntryMessages |
| | 570 | |
|
| 952 | 571 | | End Get |
| 324 | 572 | | Set |
| | 573 | |
|
| 648 | 574 | | Initialize() |
| 648 | 575 | | _allowMultiEntryMessages = Value |
| | 576 | |
|
| 648 | 577 | | End Set |
| | 578 | |
|
| | 579 | | End Property |
| | 580 | |
|
| | 581 | | ''' <summary> |
| | 582 | | ''' Gets a value indicating whether this instance is initialized. |
| | 583 | | ''' </summary> |
| | 584 | | ''' <value> |
| | 585 | | ''' <c>true</c> if this instance is initialized; otherwise, <c>false</c>. |
| | 586 | | ''' </value> |
| | 587 | | Public ReadOnly Property IsInitialized As Boolean |
| | 588 | |
|
| 4 | 589 | | Get |
| 8 | 590 | | Return _isInitialized |
| | 591 | |
|
| 8 | 592 | | End Get |
| | 593 | |
|
| | 594 | | End Property |
| | 595 | |
|
| | 596 | | ''' <summary> |
| | 597 | | ''' Gets or sets a value indicating whether to include the source in the message. |
| | 598 | | ''' </summary> |
| | 599 | | ''' <value> |
| | 600 | | ''' <c>true</c> if the source should be included in the message; otherwise, <c>false</c>. |
| | 601 | | ''' </value> |
| | 602 | | Public Property IncludeSourceInMessage As Boolean |
| 276 | 603 | | Get |
| 552 | 604 | | Initialize() |
| 552 | 605 | | Return _IncludeSourceInMessage |
| 552 | 606 | | End Get |
| 260 | 607 | | Set |
| 520 | 608 | | Initialize() |
| 520 | 609 | | _IncludeSourceInMessage = Value |
| 520 | 610 | | End Set |
| | 611 | | End Property |
| | 612 | |
|
| | 613 | | ''' <summary> |
| | 614 | | ''' Gets or sets the minimum <see cref="LoggingLevel"/> that must be met |
| | 615 | | ''' for log entries to be written. |
| | 616 | | ''' </summary> |
| | 617 | | ''' <value> |
| | 618 | | ''' The currently active logging level. Entries with a severity below this level |
| | 619 | | ''' will be ignored. Defaults to <see cref="LoggingLevel.Normal"/>. |
| | 620 | | ''' </value> |
| | 621 | | ''' <remarks> |
| | 622 | | ''' This property acts as a global filter to increase or decrease the verbosity |
| | 623 | | ''' of logging at runtime. For example, setting this to |
| | 624 | | ''' <see cref="LoggingLevel.Verbose"/> allows all entries to be logged, while |
| | 625 | | ''' <see cref="LoggingLevel.Minimal"/> ensures only warnings, errors, and critical |
| | 626 | | ''' entries are written. |
| | 627 | | ''' </remarks> |
| | 628 | | Public Property CurrentLoggingLevel As LoggingLevel |
| | 629 | |
|
| 524 | 630 | | Get |
| | 631 | |
|
| 1048 | 632 | | Initialize() |
| 1048 | 633 | | Return _CurrentLoggingLevel |
| | 634 | |
|
| 1048 | 635 | | End Get |
| 332 | 636 | | Set |
| | 637 | |
|
| 664 | 638 | | Initialize() |
| 664 | 639 | | _CurrentLoggingLevel = Value |
| | 640 | |
|
| 664 | 641 | | End Set |
| | 642 | |
|
| | 643 | | End Property |
| | 644 | |
|
| | 645 | | ''' <summary> |
| | 646 | | ''' Gets or sets the default <see cref="LoggingSeverity"/> applied to log entries |
| | 647 | | ''' when no explicit severity is specified. |
| | 648 | | ''' </summary> |
| | 649 | | ''' <value> |
| | 650 | | ''' The default severity level for new log entries. Defaults to |
| | 651 | | ''' <see cref="LoggingSeverity.Info"/>. |
| | 652 | | ''' </value> |
| | 653 | | ''' <remarks> |
| | 654 | | ''' This property determines the baseline importance assigned to entries that do |
| | 655 | | ''' not specify a severity. For example, a call such as |
| | 656 | | ''' <c>SmartEventLogger.Log("Started service.")</c> will use this value. |
| | 657 | | ''' Combined with <see cref="CurrentLoggingLevel"/>, it controls whether the |
| | 658 | | ''' entry is written or ignored. |
| | 659 | | ''' </remarks> |
| | 660 | | Public Property LoggingSeverity As LoggingSeverity |
| | 661 | |
|
| 352 | 662 | | Get |
| | 663 | |
|
| 704 | 664 | | Initialize() |
| 704 | 665 | | Return _LoggingSeverity |
| | 666 | |
|
| 704 | 667 | | End Get |
| 252 | 668 | | Set |
| | 669 | |
|
| 504 | 670 | | Initialize() |
| 504 | 671 | | _LoggingSeverity = Value |
| | 672 | |
|
| 504 | 673 | | End Set |
| | 674 | |
|
| | 675 | | End Property |
| | 676 | |
|
| | 677 | | ''' <summary> |
| | 678 | | ''' Gets or sets the strategy used when resolving event sources that are |
| | 679 | | ''' registered under a different log than the one requested. |
| | 680 | | ''' </summary> |
| | 681 | | ''' <value> |
| | 682 | | ''' A <see cref="SourceResolutionBehavior"/> value that determines whether logging |
| | 683 | | ''' requires an exact source-to-log match (<c>Strict</c>), automatically switches |
| | 684 | | ''' to the log where the source is registered (<c>UseSourceLog</c>), or creates a |
| | 685 | | ''' new source under the requested log (<c>CreateNewSource</c>). |
| | 686 | | ''' </value> |
| | 687 | | ''' <remarks> |
| | 688 | | ''' This setting controls how <see cref="SmartEventLogger"/> handles cases where |
| | 689 | | ''' the requested source and log are not aligned, which can occur on |
| | 690 | | ''' misconfigured systems or when reusing existing event sources. |
| | 691 | | ''' </remarks> |
| | 692 | | Public Property SourceResolutionBehavior As SourceResolutionBehavior |
| | 693 | |
|
| 252 | 694 | | Get |
| | 695 | |
|
| 504 | 696 | | Initialize() |
| 504 | 697 | | Return _sourceResolutionBehavior |
| | 698 | |
|
| 504 | 699 | | End Get |
| 260 | 700 | | Set |
| | 701 | |
|
| 520 | 702 | | Initialize() |
| 520 | 703 | | _sourceResolutionBehavior = Value |
| | 704 | |
|
| 520 | 705 | | End Set |
| | 706 | |
|
| | 707 | | End Property |
| | 708 | |
|
| | 709 | | ''' <summary> |
| | 710 | | ''' Gets or sets the file system. |
| | 711 | | ''' </summary> |
| | 712 | | ''' <value> |
| | 713 | | ''' The file system. |
| | 714 | | ''' </value> |
| 8 | 715 | | Friend Property FileSystem As IFileSystemShim = New RealFileSystemShim() |
| | 716 | |
|
| | 717 | | ''' <summary> |
| | 718 | | ''' Gets or sets the configuration. |
| | 719 | | ''' </summary> |
| | 720 | | ''' <value> |
| | 721 | | ''' The configuration. |
| | 722 | | ''' </value> |
| 8 | 723 | | Friend Property Config As IConfigShim = New RealConfigShim() |
| | 724 | |
|
| | 725 | | ''' <summary> |
| | 726 | | ''' Gets or sets the JSON settings file name to check for configuration. |
| | 727 | | ''' Defaults to "appsettings.json". |
| | 728 | | ''' </summary> |
| 8 | 729 | | Friend Property JsonSettingsFile As String = "appsettings.json" |
| | 730 | |
|
| | 731 | | #End Region |
| | 732 | |
|
| | 733 | | #Region " Log Methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
| | 734 | |
|
| | 735 | | ''' <summary> |
| | 736 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 737 | | ''' </summary> |
| | 738 | | ''' <param name="message"> |
| | 739 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 740 | | ''' |
| | 741 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 742 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 743 | | ''' |
| | 744 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 745 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 746 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 747 | | ''' </param> |
| | 748 | | ''' <remarks> |
| | 749 | | ''' <para> |
| | 750 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 751 | | ''' </para> |
| | 752 | | ''' <para> |
| | 753 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 754 | | ''' </para> |
| | 755 | | ''' </remarks> |
| 8 | 756 | | Public Sub Log( |
| 8 | 757 | | ByVal message As String) |
| | 758 | |
|
| 16 | 759 | | Log("", |
| 16 | 760 | | "", |
| 16 | 761 | | message) |
| | 762 | |
|
| 16 | 763 | | End Sub |
| | 764 | |
|
| | 765 | | ''' <summary> |
| | 766 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 767 | | ''' </summary> |
| | 768 | | ''' <param name="message"> |
| | 769 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 770 | | ''' |
| | 771 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 772 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 773 | | ''' |
| | 774 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 775 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 776 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 777 | | ''' </param> |
| | 778 | | ''' <param name="EntrySeverity"> |
| | 779 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 780 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 781 | | ''' will be skipped and not written to the Event Log. |
| | 782 | | ''' </param> |
| | 783 | | ''' <remarks> |
| | 784 | | ''' <para> |
| | 785 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 786 | | ''' </para> |
| | 787 | | ''' <para> |
| | 788 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 789 | | ''' </para> |
| | 790 | | ''' </remarks> |
| 20 | 791 | | Public Sub Log( |
| 20 | 792 | | ByVal message As String, |
| 20 | 793 | | ByVal EntrySeverity As LoggingSeverity) |
| | 794 | |
|
| 40 | 795 | | Log("", |
| 40 | 796 | | "", |
| 40 | 797 | | message, |
| 40 | 798 | | EntrySeverity) |
| | 799 | |
|
| 40 | 800 | | End Sub |
| | 801 | |
|
| | 802 | | ''' <summary> |
| | 803 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 804 | | ''' </summary> |
| | 805 | | ''' <param name="source"> |
| | 806 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 807 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 808 | | ''' </param> |
| | 809 | | ''' <param name="message"> |
| | 810 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 811 | | ''' |
| | 812 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 813 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 814 | | ''' |
| | 815 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 816 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 817 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 818 | | ''' </param> |
| | 819 | | ''' <remarks> |
| | 820 | | ''' <para> |
| | 821 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 822 | | ''' </para> |
| | 823 | | ''' <para> |
| | 824 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 825 | | ''' </para> |
| | 826 | | ''' </remarks> |
| 4 | 827 | | Public Sub Log( |
| 4 | 828 | | ByVal source As String, |
| 4 | 829 | | ByVal message As String) |
| | 830 | |
|
| 8 | 831 | | Log("", |
| 8 | 832 | | source, |
| 8 | 833 | | message) |
| | 834 | |
|
| 8 | 835 | | End Sub |
| | 836 | |
|
| | 837 | | ''' <summary> |
| | 838 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 839 | | ''' </summary> |
| | 840 | | ''' <param name="source"> |
| | 841 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 842 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 843 | | ''' </param> |
| | 844 | | ''' <param name="message"> |
| | 845 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 846 | | ''' |
| | 847 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 848 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 849 | | ''' |
| | 850 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 851 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 852 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 853 | | ''' </param> |
| | 854 | | ''' <param name="EntrySeverity"> |
| | 855 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 856 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 857 | | ''' will be skipped and not written to the Event Log. |
| | 858 | | ''' </param> |
| | 859 | | ''' <remarks> |
| | 860 | | ''' <para> |
| | 861 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 862 | | ''' </para> |
| | 863 | | ''' <para> |
| | 864 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 865 | | ''' </para> |
| | 866 | | ''' </remarks> |
| 4 | 867 | | Public Sub Log( |
| 4 | 868 | | ByVal source As String, |
| 4 | 869 | | ByVal message As String, |
| 4 | 870 | | ByVal EntrySeverity As LoggingSeverity) |
| | 871 | |
|
| 8 | 872 | | Log("", |
| 8 | 873 | | source, |
| 8 | 874 | | message, |
| 8 | 875 | | EntrySeverity) |
| | 876 | |
|
| 8 | 877 | | End Sub |
| | 878 | |
|
| | 879 | | ''' <summary> |
| | 880 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 881 | | ''' </summary> |
| | 882 | | ''' <param name="message"> |
| | 883 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 884 | | ''' |
| | 885 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 886 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 887 | | ''' |
| | 888 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 889 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 890 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 891 | | ''' </param> |
| | 892 | | ''' <param name="eventType"> |
| | 893 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 894 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 895 | | ''' </param> |
| | 896 | | ''' <remarks> |
| | 897 | | ''' <para> |
| | 898 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 899 | | ''' </para> |
| | 900 | | ''' <para> |
| | 901 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 902 | | ''' </para> |
| | 903 | | ''' </remarks> |
| 4 | 904 | | Public Sub Log( |
| 4 | 905 | | ByVal message As String, |
| 4 | 906 | | ByVal eventType As EventLogEntryType) |
| | 907 | |
|
| 8 | 908 | | Log("", |
| 8 | 909 | | message, |
| 8 | 910 | | eventType) |
| | 911 | |
|
| 8 | 912 | | End Sub |
| | 913 | |
|
| | 914 | | ''' <summary> |
| | 915 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 916 | | ''' </summary> |
| | 917 | | ''' <param name="message"> |
| | 918 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 919 | | ''' |
| | 920 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 921 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 922 | | ''' |
| | 923 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 924 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 925 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 926 | | ''' </param> |
| | 927 | | ''' <param name="eventType"> |
| | 928 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 929 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 930 | | ''' </param> |
| | 931 | | ''' <param name="EntrySeverity"> |
| | 932 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 933 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 934 | | ''' will be skipped and not written to the Event Log. |
| | 935 | | ''' </param> |
| | 936 | | ''' <remarks> |
| | 937 | | ''' <para> |
| | 938 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 939 | | ''' </para> |
| | 940 | | ''' <para> |
| | 941 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 942 | | ''' </para> |
| | 943 | | ''' </remarks> |
| 4 | 944 | | Public Sub Log( |
| 4 | 945 | | ByVal message As String, |
| 4 | 946 | | ByVal eventType As EventLogEntryType, |
| 4 | 947 | | ByVal EntrySeverity As LoggingSeverity) |
| | 948 | |
|
| 8 | 949 | | Log("", |
| 8 | 950 | | message, |
| 8 | 951 | | eventType, |
| 8 | 952 | | EntrySeverity) |
| | 953 | |
|
| 8 | 954 | | End Sub |
| | 955 | |
|
| | 956 | | ''' <summary> |
| | 957 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 958 | | ''' </summary> |
| | 959 | | ''' <param name="logName"> |
| | 960 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 961 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 962 | | ''' </param> |
| | 963 | | ''' <param name="sourceName"> |
| | 964 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 965 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 966 | | ''' </param> |
| | 967 | | ''' <param name="message"> |
| | 968 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 969 | | ''' |
| | 970 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 971 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 972 | | ''' |
| | 973 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 974 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 975 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 976 | | ''' </param> |
| | 977 | | ''' <remarks> |
| | 978 | | ''' <para> |
| | 979 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 980 | | ''' </para> |
| | 981 | | ''' <para> |
| | 982 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 983 | | ''' </para> |
| | 984 | | ''' </remarks> |
| 16 | 985 | | Public Sub Log( |
| 16 | 986 | | ByVal logName As String, |
| 16 | 987 | | ByVal sourceName As String, |
| 16 | 988 | | ByVal message As String) |
| | 989 | |
|
| 32 | 990 | | Log(logName, |
| 32 | 991 | | sourceName, |
| 32 | 992 | | message, |
| 32 | 993 | | EventLogEntryType.Information) |
| | 994 | |
|
| 32 | 995 | | End Sub |
| | 996 | |
|
| | 997 | | ''' <summary> |
| | 998 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 999 | | ''' </summary> |
| | 1000 | | ''' <param name="logName"> |
| | 1001 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 1002 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 1003 | | ''' </param> |
| | 1004 | | ''' <param name="sourceName"> |
| | 1005 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1006 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1007 | | ''' </param> |
| | 1008 | | ''' <param name="message"> |
| | 1009 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1010 | | ''' |
| | 1011 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1012 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1013 | | ''' |
| | 1014 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1015 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1016 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1017 | | ''' </param> |
| | 1018 | | ''' <param name="EntrySeverity"> |
| | 1019 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1020 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1021 | | ''' will be skipped and not written to the Event Log. |
| | 1022 | | ''' </param> |
| | 1023 | | ''' <remarks> |
| | 1024 | | ''' <para> |
| | 1025 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1026 | | ''' </para> |
| | 1027 | | ''' <para> |
| | 1028 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1029 | | ''' </para> |
| | 1030 | | ''' </remarks> |
| 24 | 1031 | | Public Sub Log( |
| 24 | 1032 | | ByVal logName As String, |
| 24 | 1033 | | ByVal sourceName As String, |
| 24 | 1034 | | ByVal message As String, |
| 24 | 1035 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1036 | |
|
| 48 | 1037 | | Log(logName, |
| 48 | 1038 | | sourceName, |
| 48 | 1039 | | message, |
| 48 | 1040 | | EventLogEntryType.Information, |
| 48 | 1041 | | EntrySeverity) |
| | 1042 | |
|
| 48 | 1043 | | End Sub |
| | 1044 | |
|
| | 1045 | | ''' <summary> |
| | 1046 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1047 | | ''' </summary> |
| | 1048 | | ''' <param name="sourceName"> |
| | 1049 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1050 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1051 | | ''' </param> |
| | 1052 | | ''' <param name="message"> |
| | 1053 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1054 | | ''' |
| | 1055 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1056 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1057 | | ''' |
| | 1058 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1059 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1060 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1061 | | ''' </param> |
| | 1062 | | ''' <param name="eventType"> |
| | 1063 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1064 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1065 | | ''' </param> |
| | 1066 | | ''' <remarks> |
| | 1067 | | ''' <para> |
| | 1068 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1069 | | ''' </para> |
| | 1070 | | ''' <para> |
| | 1071 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1072 | | ''' </para> |
| | 1073 | | ''' </remarks> |
| 8 | 1074 | | Public Sub Log( |
| 8 | 1075 | | ByVal sourceName As String, |
| 8 | 1076 | | ByVal message As String, |
| 8 | 1077 | | ByVal eventType As EventLogEntryType) |
| | 1078 | |
|
| 16 | 1079 | | Log("", |
| 16 | 1080 | | sourceName, |
| 16 | 1081 | | message, |
| 16 | 1082 | | eventType) |
| | 1083 | |
|
| 16 | 1084 | | End Sub |
| | 1085 | |
|
| | 1086 | | ''' <summary> |
| | 1087 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1088 | | ''' </summary> |
| | 1089 | | ''' <param name="sourceName"> |
| | 1090 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1091 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1092 | | ''' </param> |
| | 1093 | | ''' <param name="message"> |
| | 1094 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1095 | | ''' |
| | 1096 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1097 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1098 | | ''' |
| | 1099 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1100 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1101 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1102 | | ''' </param> |
| | 1103 | | ''' <param name="eventType"> |
| | 1104 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1105 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1106 | | ''' </param> |
| | 1107 | | ''' <param name="EntrySeverity"> |
| | 1108 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1109 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1110 | | ''' will be skipped and not written to the Event Log. |
| | 1111 | | ''' </param> |
| | 1112 | | ''' <remarks> |
| | 1113 | | ''' <para> |
| | 1114 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1115 | | ''' </para> |
| | 1116 | | ''' <para> |
| | 1117 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1118 | | ''' </para> |
| | 1119 | | ''' </remarks> |
| 4 | 1120 | | Public Sub Log( |
| 4 | 1121 | | ByVal sourceName As String, |
| 4 | 1122 | | ByVal message As String, |
| 4 | 1123 | | ByVal eventType As EventLogEntryType, |
| 4 | 1124 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1125 | |
|
| 8 | 1126 | | Log("", |
| 8 | 1127 | | sourceName, |
| 8 | 1128 | | message, |
| 8 | 1129 | | eventType, |
| 8 | 1130 | | EntrySeverity) |
| | 1131 | |
|
| 8 | 1132 | | End Sub |
| | 1133 | |
|
| | 1134 | | ''' <summary> |
| | 1135 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1136 | | ''' </summary> |
| | 1137 | | ''' <param name="logName"> |
| | 1138 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 1139 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 1140 | | ''' </param> |
| | 1141 | | ''' <param name="sourceName"> |
| | 1142 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1143 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1144 | | ''' </param> |
| | 1145 | | ''' <param name="message"> |
| | 1146 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1147 | | ''' |
| | 1148 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1149 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1150 | | ''' |
| | 1151 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1152 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1153 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1154 | | ''' </param> |
| | 1155 | | ''' <param name="eventType"> |
| | 1156 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1157 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1158 | | ''' </param> |
| | 1159 | | ''' <remarks> |
| | 1160 | | ''' <para> |
| | 1161 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1162 | | ''' </para> |
| | 1163 | | ''' <para> |
| | 1164 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1165 | | ''' </para> |
| | 1166 | | ''' </remarks> |
| 28 | 1167 | | Public Sub Log( |
| 28 | 1168 | | ByVal logName As String, |
| 28 | 1169 | | ByVal sourceName As String, |
| 28 | 1170 | | ByVal message As String, |
| 28 | 1171 | | ByVal eventType As EventLogEntryType) |
| | 1172 | |
|
| 56 | 1173 | | Log(logName, |
| 56 | 1174 | | sourceName, |
| 56 | 1175 | | message, |
| 56 | 1176 | | eventType, |
| 56 | 1177 | | 0) |
| | 1178 | |
|
| 56 | 1179 | | End Sub |
| | 1180 | |
|
| | 1181 | | ''' <summary> |
| | 1182 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1183 | | ''' </summary> |
| | 1184 | | ''' <param name="logName"> |
| | 1185 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 1186 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 1187 | | ''' </param> |
| | 1188 | | ''' <param name="sourceName"> |
| | 1189 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1190 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1191 | | ''' </param> |
| | 1192 | | ''' <param name="message"> |
| | 1193 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1194 | | ''' |
| | 1195 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1196 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1197 | | ''' |
| | 1198 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1199 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1200 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1201 | | ''' </param> |
| | 1202 | | ''' <param name="eventType"> |
| | 1203 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1204 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1205 | | ''' </param> |
| | 1206 | | ''' <param name="EntrySeverity"> |
| | 1207 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1208 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1209 | | ''' will be skipped and not written to the Event Log. |
| | 1210 | | ''' </param> |
| | 1211 | | ''' <remarks> |
| | 1212 | | ''' <para> |
| | 1213 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1214 | | ''' </para> |
| | 1215 | | ''' <para> |
| | 1216 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1217 | | ''' </para> |
| | 1218 | | ''' </remarks> |
| 28 | 1219 | | Public Sub Log( |
| 28 | 1220 | | ByVal logName As String, |
| 28 | 1221 | | ByVal sourceName As String, |
| 28 | 1222 | | ByVal message As String, |
| 28 | 1223 | | ByVal eventType As EventLogEntryType, |
| 28 | 1224 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1225 | |
|
| 56 | 1226 | | Log(logName, |
| 56 | 1227 | | sourceName, |
| 56 | 1228 | | message, |
| 56 | 1229 | | eventType, |
| 56 | 1230 | | 0, |
| 56 | 1231 | | EntrySeverity) |
| | 1232 | |
|
| 56 | 1233 | | End Sub |
| | 1234 | |
|
| | 1235 | | ''' <summary> |
| | 1236 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1237 | | ''' </summary> |
| | 1238 | | ''' <param name="message"> |
| | 1239 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1240 | | ''' |
| | 1241 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1242 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1243 | | ''' |
| | 1244 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1245 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1246 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1247 | | ''' </param> |
| | 1248 | | ''' <param name="eventType"> |
| | 1249 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1250 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1251 | | ''' </param> |
| | 1252 | | ''' <param name="eventID"> |
| | 1253 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1254 | | ''' </param> |
| | 1255 | | ''' <remarks> |
| | 1256 | | ''' <para> |
| | 1257 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1258 | | ''' </para> |
| | 1259 | | ''' <para> |
| | 1260 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1261 | | ''' </para> |
| | 1262 | | ''' </remarks> |
| 4 | 1263 | | Public Sub Log( |
| 4 | 1264 | | ByVal message As String, |
| 4 | 1265 | | ByVal eventType As EventLogEntryType, |
| 4 | 1266 | | ByVal eventID As Integer) |
| | 1267 | |
|
| 8 | 1268 | | Log("", |
| 8 | 1269 | | message, |
| 8 | 1270 | | eventType, |
| 8 | 1271 | | eventID) |
| | 1272 | |
|
| 8 | 1273 | | End Sub |
| | 1274 | |
|
| | 1275 | | ''' <summary> |
| | 1276 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1277 | | ''' </summary> |
| | 1278 | | ''' <param name="message"> |
| | 1279 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1280 | | ''' |
| | 1281 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1282 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1283 | | ''' |
| | 1284 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1285 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1286 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1287 | | ''' </param> |
| | 1288 | | ''' <param name="eventType"> |
| | 1289 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1290 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1291 | | ''' </param> |
| | 1292 | | ''' <param name="eventID"> |
| | 1293 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1294 | | ''' </param> |
| | 1295 | | ''' <param name="EntrySeverity"> |
| | 1296 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1297 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1298 | | ''' will be skipped and not written to the Event Log. |
| | 1299 | | ''' </param> |
| | 1300 | | ''' <remarks> |
| | 1301 | | ''' <para> |
| | 1302 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1303 | | ''' </para> |
| | 1304 | | ''' <para> |
| | 1305 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1306 | | ''' </para> |
| | 1307 | | ''' </remarks> |
| 4 | 1308 | | Public Sub Log( |
| 4 | 1309 | | ByVal message As String, |
| 4 | 1310 | | ByVal eventType As EventLogEntryType, |
| 4 | 1311 | | ByVal eventID As Integer, |
| 4 | 1312 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1313 | |
|
| 8 | 1314 | | Log("", |
| 8 | 1315 | | message, |
| 8 | 1316 | | eventType, |
| 8 | 1317 | | eventID, |
| 8 | 1318 | | EntrySeverity) |
| | 1319 | |
|
| 8 | 1320 | | End Sub |
| | 1321 | |
|
| | 1322 | | ''' <summary> |
| | 1323 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1324 | | ''' </summary> |
| | 1325 | | ''' <param name="sourceName"> |
| | 1326 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1327 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1328 | | ''' </param> |
| | 1329 | | ''' <param name="message"> |
| | 1330 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1331 | | ''' |
| | 1332 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1333 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1334 | | ''' |
| | 1335 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1336 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1337 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1338 | | ''' </param> |
| | 1339 | | ''' <param name="eventType"> |
| | 1340 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1341 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1342 | | ''' </param> |
| | 1343 | | ''' <param name="eventID"> |
| | 1344 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1345 | | ''' </param> |
| | 1346 | | ''' <remarks> |
| | 1347 | | ''' <para> |
| | 1348 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1349 | | ''' </para> |
| | 1350 | | ''' <para> |
| | 1351 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1352 | | ''' </para> |
| | 1353 | | ''' </remarks> |
| 4 | 1354 | | Public Sub Log( |
| 4 | 1355 | | ByVal sourceName As String, |
| 4 | 1356 | | ByVal message As String, |
| 4 | 1357 | | ByVal eventType As EventLogEntryType, |
| 4 | 1358 | | ByVal eventID As Integer) |
| | 1359 | |
|
| 8 | 1360 | | Log("", |
| 8 | 1361 | | sourceName, |
| 8 | 1362 | | message, |
| 8 | 1363 | | eventType, |
| 8 | 1364 | | eventID) |
| | 1365 | |
|
| 8 | 1366 | | End Sub |
| | 1367 | |
|
| | 1368 | | ''' <summary> |
| | 1369 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1370 | | ''' </summary> |
| | 1371 | | ''' <param name="sourceName"> |
| | 1372 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1373 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1374 | | ''' </param> |
| | 1375 | | ''' <param name="message"> |
| | 1376 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1377 | | ''' |
| | 1378 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1379 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1380 | | ''' |
| | 1381 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1382 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1383 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1384 | | ''' </param> |
| | 1385 | | ''' <param name="eventType"> |
| | 1386 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1387 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1388 | | ''' </param> |
| | 1389 | | ''' <param name="eventID"> |
| | 1390 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1391 | | ''' </param> |
| | 1392 | | ''' <param name="EntrySeverity"> |
| | 1393 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1394 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1395 | | ''' will be skipped and not written to the Event Log. |
| | 1396 | | ''' </param> |
| | 1397 | | ''' <remarks> |
| | 1398 | | ''' <para> |
| | 1399 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1400 | | ''' </para> |
| | 1401 | | ''' <para> |
| | 1402 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1403 | | ''' </para> |
| | 1404 | | ''' </remarks> |
| 4 | 1405 | | Public Sub Log( |
| 4 | 1406 | | ByVal sourceName As String, |
| 4 | 1407 | | ByVal message As String, |
| 4 | 1408 | | ByVal eventType As EventLogEntryType, |
| 4 | 1409 | | ByVal eventID As Integer, |
| 4 | 1410 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1411 | |
|
| 8 | 1412 | | Log("", |
| 8 | 1413 | | sourceName, |
| 8 | 1414 | | message, |
| 8 | 1415 | | eventType, |
| 8 | 1416 | | eventID, |
| 8 | 1417 | | EntrySeverity) |
| | 1418 | |
|
| 8 | 1419 | | End Sub |
| | 1420 | |
|
| | 1421 | | ''' <summary> |
| | 1422 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1423 | | ''' </summary> |
| | 1424 | | ''' <param name="logName"> |
| | 1425 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 1426 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 1427 | | ''' </param> |
| | 1428 | | ''' <param name="sourceName"> |
| | 1429 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1430 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1431 | | ''' </param> |
| | 1432 | | ''' <param name="message"> |
| | 1433 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1434 | | ''' |
| | 1435 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1436 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1437 | | ''' |
| | 1438 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1439 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1440 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1441 | | ''' </param> |
| | 1442 | | ''' <param name="eventType"> |
| | 1443 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1444 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1445 | | ''' </param> |
| | 1446 | | ''' <param name="eventID"> |
| | 1447 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1448 | | ''' </param> |
| | 1449 | | ''' <remarks> |
| | 1450 | | ''' <para> |
| | 1451 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1452 | | ''' </para> |
| | 1453 | | ''' <para> |
| | 1454 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1455 | | ''' </para> |
| | 1456 | | ''' </remarks> |
| 36 | 1457 | | Public Sub Log( |
| 36 | 1458 | | ByVal logName As String, |
| 36 | 1459 | | ByVal sourceName As String, |
| 36 | 1460 | | ByVal message As String, |
| 36 | 1461 | | ByVal eventType As EventLogEntryType, |
| 36 | 1462 | | ByVal eventID As Integer) |
| | 1463 | |
|
| 72 | 1464 | | Log(logName, |
| 72 | 1465 | | sourceName, |
| 72 | 1466 | | message, |
| 72 | 1467 | | eventType, |
| 72 | 1468 | | eventID, |
| 72 | 1469 | | 0) |
| | 1470 | |
|
| 72 | 1471 | | End Sub |
| | 1472 | |
|
| | 1473 | | ''' <summary> |
| | 1474 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1475 | | ''' </summary> |
| | 1476 | | ''' <param name="logName"> |
| | 1477 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 1478 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 1479 | | ''' </param> |
| | 1480 | | ''' <param name="sourceName"> |
| | 1481 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1482 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1483 | | ''' </param> |
| | 1484 | | ''' <param name="message"> |
| | 1485 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1486 | | ''' |
| | 1487 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1488 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1489 | | ''' |
| | 1490 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1491 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1492 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1493 | | ''' </param> |
| | 1494 | | ''' <param name="eventType"> |
| | 1495 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1496 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1497 | | ''' </param> |
| | 1498 | | ''' <param name="eventID"> |
| | 1499 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1500 | | ''' </param> |
| | 1501 | | ''' <param name="EntrySeverity"> |
| | 1502 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1503 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1504 | | ''' will be skipped and not written to the Event Log. |
| | 1505 | | ''' </param> |
| | 1506 | | ''' <remarks> |
| | 1507 | | ''' <para> |
| | 1508 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1509 | | ''' </para> |
| | 1510 | | ''' <para> |
| | 1511 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1512 | | ''' </para> |
| | 1513 | | ''' </remarks> |
| 68 | 1514 | | Public Sub Log( |
| 68 | 1515 | | ByVal logName As String, |
| 68 | 1516 | | ByVal sourceName As String, |
| 68 | 1517 | | ByVal message As String, |
| 68 | 1518 | | ByVal eventType As EventLogEntryType, |
| 68 | 1519 | | ByVal eventID As Integer, |
| 68 | 1520 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1521 | |
|
| 136 | 1522 | | Log(logName, |
| 136 | 1523 | | sourceName, |
| 136 | 1524 | | message, |
| 136 | 1525 | | eventType, |
| 136 | 1526 | | eventID, |
| 136 | 1527 | | 0, |
| 136 | 1528 | | EntrySeverity) |
| | 1529 | |
|
| 136 | 1530 | | End Sub |
| | 1531 | |
|
| | 1532 | | ''' <summary> |
| | 1533 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1534 | | ''' </summary> |
| | 1535 | | ''' <param name="message"> |
| | 1536 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1537 | | ''' |
| | 1538 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1539 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1540 | | ''' |
| | 1541 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1542 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1543 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1544 | | ''' </param> |
| | 1545 | | ''' <param name="eventType"> |
| | 1546 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1547 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1548 | | ''' </param> |
| | 1549 | | ''' <param name="eventID"> |
| | 1550 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1551 | | ''' </param> |
| | 1552 | | ''' <param name="category"> |
| | 1553 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 1554 | | ''' </param> |
| | 1555 | | ''' <remarks> |
| | 1556 | | ''' <para> |
| | 1557 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1558 | | ''' </para> |
| | 1559 | | ''' <para> |
| | 1560 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1561 | | ''' </para> |
| | 1562 | | ''' </remarks> |
| 4 | 1563 | | Public Sub Log( |
| 4 | 1564 | | ByVal message As String, |
| 4 | 1565 | | ByVal eventType As EventLogEntryType, |
| 4 | 1566 | | ByVal eventID As Integer, |
| 4 | 1567 | | ByVal category As Short) |
| | 1568 | |
|
| 8 | 1569 | | Log("", |
| 8 | 1570 | | message, |
| 8 | 1571 | | eventType, |
| 8 | 1572 | | eventID, |
| 8 | 1573 | | category) |
| | 1574 | |
|
| 8 | 1575 | | End Sub |
| | 1576 | |
|
| | 1577 | | ''' <summary> |
| | 1578 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1579 | | ''' </summary> |
| | 1580 | | ''' <param name="message"> |
| | 1581 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1582 | | ''' |
| | 1583 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1584 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1585 | | ''' |
| | 1586 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1587 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1588 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1589 | | ''' </param> |
| | 1590 | | ''' <param name="eventType"> |
| | 1591 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1592 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1593 | | ''' </param> |
| | 1594 | | ''' <param name="eventID"> |
| | 1595 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1596 | | ''' </param> |
| | 1597 | | ''' <param name="category"> |
| | 1598 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 1599 | | ''' </param> |
| | 1600 | | ''' <param name="EntrySeverity"> |
| | 1601 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1602 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1603 | | ''' will be skipped and not written to the Event Log. |
| | 1604 | | ''' </param> |
| | 1605 | | ''' <remarks> |
| | 1606 | | ''' <para> |
| | 1607 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1608 | | ''' </para> |
| | 1609 | | ''' <para> |
| | 1610 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1611 | | ''' </para> |
| | 1612 | | ''' </remarks> |
| 4 | 1613 | | Public Sub Log( |
| 4 | 1614 | | ByVal message As String, |
| 4 | 1615 | | ByVal eventType As EventLogEntryType, |
| 4 | 1616 | | ByVal eventID As Integer, |
| 4 | 1617 | | ByVal category As Short, |
| 4 | 1618 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1619 | |
|
| 8 | 1620 | | Log("", |
| 8 | 1621 | | message, |
| 8 | 1622 | | eventType, |
| 8 | 1623 | | eventID, |
| 8 | 1624 | | category, |
| 8 | 1625 | | EntrySeverity) |
| | 1626 | |
|
| 8 | 1627 | | End Sub |
| | 1628 | |
|
| | 1629 | | ''' <summary> |
| | 1630 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1631 | | ''' </summary> |
| | 1632 | | ''' <param name="sourceName"> |
| | 1633 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1634 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1635 | | ''' </param> |
| | 1636 | | ''' <param name="message"> |
| | 1637 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1638 | | ''' |
| | 1639 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1640 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1641 | | ''' |
| | 1642 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1643 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1644 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1645 | | ''' </param> |
| | 1646 | | ''' <param name="eventType"> |
| | 1647 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1648 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1649 | | ''' </param> |
| | 1650 | | ''' <param name="eventID"> |
| | 1651 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1652 | | ''' </param> |
| | 1653 | | ''' <param name="category"> |
| | 1654 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 1655 | | ''' </param> |
| | 1656 | | ''' <remarks> |
| | 1657 | | ''' <para> |
| | 1658 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1659 | | ''' </para> |
| | 1660 | | ''' <para> |
| | 1661 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1662 | | ''' </para> |
| | 1663 | | ''' </remarks> |
| 8 | 1664 | | Public Sub Log( |
| 8 | 1665 | | ByVal sourceName As String, |
| 8 | 1666 | | ByVal message As String, |
| 8 | 1667 | | ByVal eventType As EventLogEntryType, |
| 8 | 1668 | | ByVal eventID As Integer, |
| 8 | 1669 | | ByVal category As Short) |
| | 1670 | |
|
| 16 | 1671 | | Log("", |
| 16 | 1672 | | sourceName, |
| 16 | 1673 | | message, |
| 16 | 1674 | | eventType, |
| 16 | 1675 | | eventID, |
| 16 | 1676 | | category) |
| | 1677 | |
|
| 16 | 1678 | | End Sub |
| | 1679 | |
|
| | 1680 | | ''' <summary> |
| | 1681 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1682 | | ''' </summary> |
| | 1683 | | ''' <param name="sourceName"> |
| | 1684 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1685 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1686 | | ''' </param> |
| | 1687 | | ''' <param name="message"> |
| | 1688 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1689 | | ''' |
| | 1690 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1691 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1692 | | ''' |
| | 1693 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1694 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1695 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1696 | | ''' </param> |
| | 1697 | | ''' <param name="eventType"> |
| | 1698 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1699 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1700 | | ''' </param> |
| | 1701 | | ''' <param name="eventID"> |
| | 1702 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1703 | | ''' </param> |
| | 1704 | | ''' <param name="category"> |
| | 1705 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 1706 | | ''' </param> |
| | 1707 | | ''' <param name="EntrySeverity"> |
| | 1708 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1709 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1710 | | ''' will be skipped and not written to the Event Log. |
| | 1711 | | ''' </param> |
| | 1712 | | ''' <remarks> |
| | 1713 | | ''' <para> |
| | 1714 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1715 | | ''' </para> |
| | 1716 | | ''' <para> |
| | 1717 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1718 | | ''' </para> |
| | 1719 | | ''' </remarks> |
| 4 | 1720 | | Public Sub Log( |
| 4 | 1721 | | ByVal sourceName As String, |
| 4 | 1722 | | ByVal message As String, |
| 4 | 1723 | | ByVal eventType As EventLogEntryType, |
| 4 | 1724 | | ByVal eventID As Integer, |
| 4 | 1725 | | ByVal category As Short, |
| 4 | 1726 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1727 | |
|
| 8 | 1728 | | Log("", |
| 8 | 1729 | | sourceName, |
| 8 | 1730 | | message, |
| 8 | 1731 | | eventType, |
| 8 | 1732 | | eventID, |
| 8 | 1733 | | category, |
| 8 | 1734 | | EntrySeverity) |
| | 1735 | |
|
| 8 | 1736 | | End Sub |
| | 1737 | |
|
| | 1738 | | ''' <summary> |
| | 1739 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1740 | | ''' </summary> |
| | 1741 | | ''' <param name="logName"> |
| | 1742 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 1743 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 1744 | | ''' </param> |
| | 1745 | | ''' <param name="sourceName"> |
| | 1746 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1747 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1748 | | ''' </param> |
| | 1749 | | ''' <param name="message"> |
| | 1750 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1751 | | ''' |
| | 1752 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1753 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1754 | | ''' |
| | 1755 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1756 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1757 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1758 | | ''' </param> |
| | 1759 | | ''' <param name="eventType"> |
| | 1760 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1761 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1762 | | ''' </param> |
| | 1763 | | ''' <param name="eventID"> |
| | 1764 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1765 | | ''' </param> |
| | 1766 | | ''' <param name="category"> |
| | 1767 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 1768 | | ''' </param> |
| | 1769 | | ''' <remarks> |
| | 1770 | | ''' <para> |
| | 1771 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1772 | | ''' </para> |
| | 1773 | | ''' <para> |
| | 1774 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1775 | | ''' </para> |
| | 1776 | | ''' </remarks> |
| 12 | 1777 | | Public Sub Log( |
| 12 | 1778 | | ByVal logName As String, |
| 12 | 1779 | | ByVal sourceName As String, |
| 12 | 1780 | | ByVal message As String, |
| 12 | 1781 | | ByVal eventType As EventLogEntryType, |
| 12 | 1782 | | ByVal eventID As Integer, |
| 12 | 1783 | | ByVal category As Short) |
| | 1784 | |
|
| 24 | 1785 | | Log("", |
| 24 | 1786 | | logName, |
| 24 | 1787 | | sourceName, |
| 24 | 1788 | | message, |
| 24 | 1789 | | eventType, |
| 24 | 1790 | | eventID, |
| 24 | 1791 | | category, |
| 24 | 1792 | | Nothing) |
| | 1793 | |
|
| 24 | 1794 | | End Sub |
| | 1795 | |
|
| | 1796 | | ''' <summary> |
| | 1797 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1798 | | ''' </summary> |
| | 1799 | | ''' <param name="logName"> |
| | 1800 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 1801 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 1802 | | ''' </param> |
| | 1803 | | ''' <param name="sourceName"> |
| | 1804 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 1805 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 1806 | | ''' </param> |
| | 1807 | | ''' <param name="message"> |
| | 1808 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1809 | | ''' |
| | 1810 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1811 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1812 | | ''' |
| | 1813 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1814 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1815 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1816 | | ''' </param> |
| | 1817 | | ''' <param name="eventType"> |
| | 1818 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1819 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1820 | | ''' </param> |
| | 1821 | | ''' <param name="eventID"> |
| | 1822 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 1823 | | ''' </param> |
| | 1824 | | ''' <param name="category"> |
| | 1825 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 1826 | | ''' </param> |
| | 1827 | | ''' <param name="EntrySeverity"> |
| | 1828 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1829 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1830 | | ''' will be skipped and not written to the Event Log. |
| | 1831 | | ''' </param> |
| | 1832 | | ''' <remarks> |
| | 1833 | | ''' <para> |
| | 1834 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1835 | | ''' </para> |
| | 1836 | | ''' <para> |
| | 1837 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1838 | | ''' </para> |
| | 1839 | | ''' </remarks> |
| 72 | 1840 | | Public Sub Log( |
| 72 | 1841 | | ByVal logName As String, |
| 72 | 1842 | | ByVal sourceName As String, |
| 72 | 1843 | | ByVal message As String, |
| 72 | 1844 | | ByVal eventType As EventLogEntryType, |
| 72 | 1845 | | ByVal eventID As Integer, |
| 72 | 1846 | | ByVal category As Short, |
| 72 | 1847 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1848 | |
|
| 144 | 1849 | | Log("", |
| 144 | 1850 | | logName, |
| 144 | 1851 | | sourceName, |
| 144 | 1852 | | message, |
| 144 | 1853 | | eventType, |
| 144 | 1854 | | eventID, |
| 144 | 1855 | | category, |
| 144 | 1856 | | Nothing, |
| 144 | 1857 | | EntrySeverity) |
| | 1858 | |
|
| 144 | 1859 | | End Sub |
| | 1860 | |
|
| | 1861 | | ''' <summary> |
| | 1862 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1863 | | ''' </summary> |
| | 1864 | | ''' <param name="message"> |
| | 1865 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1866 | | ''' |
| | 1867 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1868 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1869 | | ''' |
| | 1870 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1871 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1872 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1873 | | ''' </param> |
| | 1874 | | ''' <param name="rawData"> |
| | 1875 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 1876 | | ''' </param> |
| | 1877 | | ''' <remarks> |
| | 1878 | | ''' <para> |
| | 1879 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1880 | | ''' </para> |
| | 1881 | | ''' <para> |
| | 1882 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1883 | | ''' </para> |
| | 1884 | | ''' </remarks> |
| 4 | 1885 | | Public Sub Log( |
| 4 | 1886 | | ByVal message As String, |
| 4 | 1887 | | ByVal rawData As Byte()) |
| | 1888 | |
|
| 8 | 1889 | | Log(message, |
| 8 | 1890 | | EventLogEntryType.Information, |
| 8 | 1891 | | rawData) |
| | 1892 | |
|
| 8 | 1893 | | End Sub |
| | 1894 | |
|
| | 1895 | | ''' <summary> |
| | 1896 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1897 | | ''' </summary> |
| | 1898 | | ''' <param name="message"> |
| | 1899 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1900 | | ''' |
| | 1901 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1902 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1903 | | ''' |
| | 1904 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1905 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1906 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1907 | | ''' </param> |
| | 1908 | | ''' <param name="rawData"> |
| | 1909 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 1910 | | ''' </param> |
| | 1911 | | ''' <param name="EntrySeverity"> |
| | 1912 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1913 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1914 | | ''' will be skipped and not written to the Event Log. |
| | 1915 | | ''' </param> |
| | 1916 | | ''' <remarks> |
| | 1917 | | ''' <para> |
| | 1918 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1919 | | ''' </para> |
| | 1920 | | ''' <para> |
| | 1921 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1922 | | ''' </para> |
| | 1923 | | ''' </remarks> |
| 4 | 1924 | | Public Sub Log( |
| 4 | 1925 | | ByVal message As String, |
| 4 | 1926 | | ByVal rawData As Byte(), |
| 4 | 1927 | | ByVal EntrySeverity As LoggingSeverity) |
| | 1928 | |
|
| 8 | 1929 | | Log(message, |
| 8 | 1930 | | EventLogEntryType.Information, |
| 8 | 1931 | | rawData, |
| 8 | 1932 | | EntrySeverity) |
| | 1933 | |
|
| 8 | 1934 | | End Sub |
| | 1935 | |
|
| | 1936 | | ''' <summary> |
| | 1937 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1938 | | ''' </summary> |
| | 1939 | | ''' <param name="message"> |
| | 1940 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1941 | | ''' |
| | 1942 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1943 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1944 | | ''' |
| | 1945 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1946 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1947 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1948 | | ''' </param> |
| | 1949 | | ''' <param name="eventType"> |
| | 1950 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1951 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1952 | | ''' </param> |
| | 1953 | | ''' <param name="rawData"> |
| | 1954 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 1955 | | ''' </param> |
| | 1956 | | ''' <remarks> |
| | 1957 | | ''' <para> |
| | 1958 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 1959 | | ''' </para> |
| | 1960 | | ''' <para> |
| | 1961 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 1962 | | ''' </para> |
| | 1963 | | ''' </remarks> |
| 8 | 1964 | | Public Sub Log( |
| 8 | 1965 | | ByVal message As String, |
| 8 | 1966 | | ByVal eventType As EventLogEntryType, |
| 8 | 1967 | | ByVal rawData As Byte()) |
| | 1968 | |
|
| 16 | 1969 | | Log(message, |
| 16 | 1970 | | eventType, |
| 16 | 1971 | | 0, |
| 16 | 1972 | | rawData) |
| | 1973 | |
|
| 16 | 1974 | | End Sub |
| | 1975 | |
|
| | 1976 | | ''' <summary> |
| | 1977 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 1978 | | ''' </summary> |
| | 1979 | | ''' <param name="message"> |
| | 1980 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 1981 | | ''' |
| | 1982 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 1983 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 1984 | | ''' |
| | 1985 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 1986 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 1987 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 1988 | | ''' </param> |
| | 1989 | | ''' <param name="eventType"> |
| | 1990 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 1991 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 1992 | | ''' </param> |
| | 1993 | | ''' <param name="rawData"> |
| | 1994 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 1995 | | ''' </param> |
| | 1996 | | ''' <param name="EntrySeverity"> |
| | 1997 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 1998 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 1999 | | ''' will be skipped and not written to the Event Log. |
| | 2000 | | ''' </param> |
| | 2001 | | ''' <remarks> |
| | 2002 | | ''' <para> |
| | 2003 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2004 | | ''' </para> |
| | 2005 | | ''' <para> |
| | 2006 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2007 | | ''' </para> |
| | 2008 | | ''' </remarks> |
| 4 | 2009 | | Public Sub Log( |
| 4 | 2010 | | ByVal message As String, |
| 4 | 2011 | | ByVal eventType As EventLogEntryType, |
| 4 | 2012 | | ByVal rawData As Byte(), |
| 4 | 2013 | | ByVal EntrySeverity As LoggingSeverity) |
| | 2014 | |
|
| 8 | 2015 | | Log(message, |
| 8 | 2016 | | eventType, |
| 8 | 2017 | | 0, |
| 8 | 2018 | | rawData, |
| 8 | 2019 | | EntrySeverity) |
| | 2020 | |
|
| 8 | 2021 | | End Sub |
| | 2022 | |
|
| | 2023 | | ''' <summary> |
| | 2024 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2025 | | ''' </summary> |
| | 2026 | | ''' <param name="message"> |
| | 2027 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2028 | | ''' |
| | 2029 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2030 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2031 | | ''' |
| | 2032 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2033 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2034 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2035 | | ''' </param> |
| | 2036 | | ''' <param name="eventType"> |
| | 2037 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2038 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2039 | | ''' </param> |
| | 2040 | | ''' <param name="eventID"> |
| | 2041 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2042 | | ''' </param> |
| | 2043 | | ''' <param name="rawData"> |
| | 2044 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2045 | | ''' </param> |
| | 2046 | | ''' <remarks> |
| | 2047 | | ''' <para> |
| | 2048 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2049 | | ''' </para> |
| | 2050 | | ''' <para> |
| | 2051 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2052 | | ''' </para> |
| | 2053 | | ''' </remarks> |
| 12 | 2054 | | Public Sub Log( |
| 12 | 2055 | | ByVal message As String, |
| 12 | 2056 | | ByVal eventType As EventLogEntryType, |
| 12 | 2057 | | ByVal eventID As Integer, |
| 12 | 2058 | | ByVal rawData As Byte()) |
| | 2059 | |
|
| 24 | 2060 | | Log(message, |
| 24 | 2061 | | eventType, |
| 24 | 2062 | | eventID, |
| 24 | 2063 | | 0, |
| 24 | 2064 | | rawData) |
| | 2065 | |
|
| 24 | 2066 | | End Sub |
| | 2067 | |
|
| | 2068 | | ''' <summary> |
| | 2069 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2070 | | ''' </summary> |
| | 2071 | | ''' <param name="message"> |
| | 2072 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2073 | | ''' |
| | 2074 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2075 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2076 | | ''' |
| | 2077 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2078 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2079 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2080 | | ''' </param> |
| | 2081 | | ''' <param name="eventType"> |
| | 2082 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2083 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2084 | | ''' </param> |
| | 2085 | | ''' <param name="eventID"> |
| | 2086 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2087 | | ''' </param> |
| | 2088 | | ''' <param name="rawData"> |
| | 2089 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2090 | | ''' </param> |
| | 2091 | | ''' <param name="EntrySeverity"> |
| | 2092 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 2093 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 2094 | | ''' will be skipped and not written to the Event Log. |
| | 2095 | | ''' </param> |
| | 2096 | | ''' <remarks> |
| | 2097 | | ''' <para> |
| | 2098 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2099 | | ''' </para> |
| | 2100 | | ''' <para> |
| | 2101 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2102 | | ''' </para> |
| | 2103 | | ''' </remarks> |
| 4 | 2104 | | Public Sub Log( |
| 4 | 2105 | | ByVal message As String, |
| 4 | 2106 | | ByVal eventType As EventLogEntryType, |
| 4 | 2107 | | ByVal eventID As Integer, |
| 4 | 2108 | | ByVal rawData As Byte(), |
| 4 | 2109 | | ByVal EntrySeverity As LoggingSeverity) |
| | 2110 | |
|
| 8 | 2111 | | Log(message, |
| 8 | 2112 | | eventType, |
| 8 | 2113 | | eventID, |
| 8 | 2114 | | 0, |
| 8 | 2115 | | rawData, |
| 8 | 2116 | | EntrySeverity) |
| | 2117 | |
|
| 8 | 2118 | | End Sub |
| | 2119 | |
|
| | 2120 | | ''' <summary> |
| | 2121 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2122 | | ''' </summary> |
| | 2123 | | ''' <param name="message"> |
| | 2124 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2125 | | ''' |
| | 2126 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2127 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2128 | | ''' |
| | 2129 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2130 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2131 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2132 | | ''' </param> |
| | 2133 | | ''' <param name="eventType"> |
| | 2134 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2135 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2136 | | ''' </param> |
| | 2137 | | ''' <param name="eventID"> |
| | 2138 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2139 | | ''' </param> |
| | 2140 | | ''' <param name="category"> |
| | 2141 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2142 | | ''' </param> |
| | 2143 | | ''' <param name="rawData"> |
| | 2144 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2145 | | ''' </param> |
| | 2146 | | ''' <remarks> |
| | 2147 | | ''' <para> |
| | 2148 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2149 | | ''' </para> |
| | 2150 | | ''' <para> |
| | 2151 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2152 | | ''' </para> |
| | 2153 | | ''' </remarks> |
| 16 | 2154 | | Public Sub Log( |
| 16 | 2155 | | ByVal message As String, |
| 16 | 2156 | | ByVal eventType As EventLogEntryType, |
| 16 | 2157 | | ByVal eventID As Integer, |
| 16 | 2158 | | ByVal category As Short, |
| 16 | 2159 | | ByVal rawData As Byte()) |
| | 2160 | |
|
| 32 | 2161 | | Log("", |
| 32 | 2162 | | "", |
| 32 | 2163 | | "", |
| 32 | 2164 | | message, |
| 32 | 2165 | | eventType, |
| 32 | 2166 | | eventID, |
| 32 | 2167 | | category, |
| 32 | 2168 | | rawData) |
| | 2169 | |
|
| 32 | 2170 | | End Sub |
| | 2171 | |
|
| | 2172 | | ''' <summary> |
| | 2173 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2174 | | ''' </summary> |
| | 2175 | | ''' <param name="message"> |
| | 2176 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2177 | | ''' |
| | 2178 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2179 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2180 | | ''' |
| | 2181 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2182 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2183 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2184 | | ''' </param> |
| | 2185 | | ''' <param name="eventType"> |
| | 2186 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2187 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2188 | | ''' </param> |
| | 2189 | | ''' <param name="eventID"> |
| | 2190 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2191 | | ''' </param> |
| | 2192 | | ''' <param name="category"> |
| | 2193 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2194 | | ''' </param> |
| | 2195 | | ''' <param name="rawData"> |
| | 2196 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2197 | | ''' </param> |
| | 2198 | | ''' <param name="EntrySeverity"> |
| | 2199 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 2200 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 2201 | | ''' will be skipped and not written to the Event Log. |
| | 2202 | | ''' </param> |
| | 2203 | | ''' <remarks> |
| | 2204 | | ''' <para> |
| | 2205 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2206 | | ''' </para> |
| | 2207 | | ''' <para> |
| | 2208 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2209 | | ''' </para> |
| | 2210 | | ''' </remarks> |
| 4 | 2211 | | Public Sub Log( |
| 4 | 2212 | | ByVal message As String, |
| 4 | 2213 | | ByVal eventType As EventLogEntryType, |
| 4 | 2214 | | ByVal eventID As Integer, |
| 4 | 2215 | | ByVal category As Short, |
| 4 | 2216 | | ByVal rawData As Byte(), |
| 4 | 2217 | | ByVal EntrySeverity As LoggingSeverity) |
| | 2218 | |
|
| 8 | 2219 | | Log("", |
| 8 | 2220 | | "", |
| 8 | 2221 | | "", |
| 8 | 2222 | | message, |
| 8 | 2223 | | eventType, |
| 8 | 2224 | | eventID, |
| 8 | 2225 | | category, |
| 8 | 2226 | | rawData, |
| 8 | 2227 | | EntrySeverity) |
| | 2228 | |
|
| 8 | 2229 | | End Sub |
| | 2230 | |
|
| | 2231 | | ''' <summary> |
| | 2232 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2233 | | ''' </summary> |
| | 2234 | | ''' <param name="sourceName"> |
| | 2235 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 2236 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 2237 | | ''' </param> |
| | 2238 | | ''' <param name="message"> |
| | 2239 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2240 | | ''' |
| | 2241 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2242 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2243 | | ''' |
| | 2244 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2245 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2246 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2247 | | ''' </param> |
| | 2248 | | ''' <param name="eventType"> |
| | 2249 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2250 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2251 | | ''' </param> |
| | 2252 | | ''' <param name="eventID"> |
| | 2253 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2254 | | ''' </param> |
| | 2255 | | ''' <param name="category"> |
| | 2256 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2257 | | ''' </param> |
| | 2258 | | ''' <param name="rawData"> |
| | 2259 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2260 | | ''' </param> |
| | 2261 | | ''' <remarks> |
| | 2262 | | ''' <para> |
| | 2263 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2264 | | ''' </para> |
| | 2265 | | ''' <para> |
| | 2266 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2267 | | ''' </para> |
| | 2268 | | ''' </remarks> |
| 4 | 2269 | | Public Sub Log( |
| 4 | 2270 | | ByVal sourceName As String, |
| 4 | 2271 | | ByVal message As String, |
| 4 | 2272 | | ByVal eventType As EventLogEntryType, |
| 4 | 2273 | | ByVal eventID As Integer, |
| 4 | 2274 | | ByVal category As Short, |
| 4 | 2275 | | ByVal rawData As Byte()) |
| | 2276 | |
|
| 8 | 2277 | | Log("", |
| 8 | 2278 | | "", |
| 8 | 2279 | | sourceName, |
| 8 | 2280 | | message, |
| 8 | 2281 | | eventType, |
| 8 | 2282 | | eventID, |
| 8 | 2283 | | category, |
| 8 | 2284 | | rawData) |
| | 2285 | |
|
| 8 | 2286 | | End Sub |
| | 2287 | |
|
| | 2288 | | ''' <summary> |
| | 2289 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2290 | | ''' </summary> |
| | 2291 | | ''' <param name="sourceName"> |
| | 2292 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 2293 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 2294 | | ''' </param> |
| | 2295 | | ''' <param name="message"> |
| | 2296 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2297 | | ''' |
| | 2298 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2299 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2300 | | ''' |
| | 2301 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2302 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2303 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2304 | | ''' </param> |
| | 2305 | | ''' <param name="eventType"> |
| | 2306 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2307 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2308 | | ''' </param> |
| | 2309 | | ''' <param name="eventID"> |
| | 2310 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2311 | | ''' </param> |
| | 2312 | | ''' <param name="category"> |
| | 2313 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2314 | | ''' </param> |
| | 2315 | | ''' <param name="rawData"> |
| | 2316 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2317 | | ''' </param> |
| | 2318 | | ''' <param name="EntrySeverity"> |
| | 2319 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 2320 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 2321 | | ''' will be skipped and not written to the Event Log. |
| | 2322 | | ''' </param> |
| | 2323 | | ''' <remarks> |
| | 2324 | | ''' <para> |
| | 2325 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2326 | | ''' </para> |
| | 2327 | | ''' <para> |
| | 2328 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2329 | | ''' </para> |
| | 2330 | | ''' </remarks> |
| 4 | 2331 | | Public Sub Log( |
| 4 | 2332 | | ByVal sourceName As String, |
| 4 | 2333 | | ByVal message As String, |
| 4 | 2334 | | ByVal eventType As EventLogEntryType, |
| 4 | 2335 | | ByVal eventID As Integer, |
| 4 | 2336 | | ByVal category As Short, |
| 4 | 2337 | | ByVal rawData As Byte(), |
| 4 | 2338 | | ByVal EntrySeverity As LoggingSeverity) |
| | 2339 | |
|
| 8 | 2340 | | Log("", |
| 8 | 2341 | | "", |
| 8 | 2342 | | sourceName, |
| 8 | 2343 | | message, |
| 8 | 2344 | | eventType, |
| 8 | 2345 | | eventID, |
| 8 | 2346 | | category, |
| 8 | 2347 | | rawData, |
| 8 | 2348 | | EntrySeverity) |
| | 2349 | |
|
| 8 | 2350 | | End Sub |
| | 2351 | |
|
| | 2352 | | ''' <summary> |
| | 2353 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2354 | | ''' </summary> |
| | 2355 | | ''' <param name="logName"> |
| | 2356 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 2357 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 2358 | | ''' </param> |
| | 2359 | | ''' <param name="source"> |
| | 2360 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 2361 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 2362 | | ''' </param> |
| | 2363 | | ''' <param name="message"> |
| | 2364 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2365 | | ''' |
| | 2366 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2367 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2368 | | ''' |
| | 2369 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2370 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2371 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2372 | | ''' </param> |
| | 2373 | | ''' <param name="eventType"> |
| | 2374 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2375 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2376 | | ''' </param> |
| | 2377 | | ''' <param name="eventID"> |
| | 2378 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2379 | | ''' </param> |
| | 2380 | | ''' <param name="category"> |
| | 2381 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2382 | | ''' </param> |
| | 2383 | | ''' <param name="rawData"> |
| | 2384 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2385 | | ''' </param> |
| | 2386 | | ''' <remarks> |
| | 2387 | | ''' <para> |
| | 2388 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2389 | | ''' </para> |
| | 2390 | | ''' <para> |
| | 2391 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2392 | | ''' </para> |
| | 2393 | | ''' </remarks> |
| 40 | 2394 | | Public Sub Log( |
| 40 | 2395 | | ByVal logName As String, |
| 40 | 2396 | | ByVal source As String, |
| 40 | 2397 | | ByVal message As String, |
| 40 | 2398 | | ByVal eventType As EventLogEntryType, |
| 40 | 2399 | | ByVal eventID As Integer, |
| 40 | 2400 | | ByVal category As Short, |
| 40 | 2401 | | ByVal rawData As Byte()) |
| | 2402 | |
|
| 80 | 2403 | | Log( |
| 80 | 2404 | | "", |
| 80 | 2405 | | logName, |
| 80 | 2406 | | source, |
| 80 | 2407 | | message, |
| 80 | 2408 | | eventType, |
| 80 | 2409 | | eventID, |
| 80 | 2410 | | category, |
| 80 | 2411 | | rawData) |
| | 2412 | |
|
| 80 | 2413 | | End Sub |
| | 2414 | |
|
| | 2415 | | ''' <summary> |
| | 2416 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2417 | | ''' </summary> |
| | 2418 | | ''' <param name="logName"> |
| | 2419 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 2420 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 2421 | | ''' </param> |
| | 2422 | | ''' <param name="source"> |
| | 2423 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 2424 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 2425 | | ''' </param> |
| | 2426 | | ''' <param name="message"> |
| | 2427 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2428 | | ''' |
| | 2429 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2430 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2431 | | ''' |
| | 2432 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2433 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2434 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2435 | | ''' </param> |
| | 2436 | | ''' <param name="eventType"> |
| | 2437 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2438 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2439 | | ''' </param> |
| | 2440 | | ''' <param name="eventID"> |
| | 2441 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2442 | | ''' </param> |
| | 2443 | | ''' <param name="category"> |
| | 2444 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2445 | | ''' </param> |
| | 2446 | | ''' <param name="rawData"> |
| | 2447 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2448 | | ''' </param> |
| | 2449 | | ''' <param name="EntrySeverity"> |
| | 2450 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 2451 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 2452 | | ''' will be skipped and not written to the Event Log. |
| | 2453 | | ''' </param> |
| | 2454 | | ''' <remarks> |
| | 2455 | | ''' <para> |
| | 2456 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2457 | | ''' </para> |
| | 2458 | | ''' <para> |
| | 2459 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2460 | | ''' </para> |
| | 2461 | | ''' </remarks> |
| 4 | 2462 | | Public Sub Log( |
| 4 | 2463 | | ByVal logName As String, |
| 4 | 2464 | | ByVal source As String, |
| 4 | 2465 | | ByVal message As String, |
| 4 | 2466 | | ByVal eventType As EventLogEntryType, |
| 4 | 2467 | | ByVal eventID As Integer, |
| 4 | 2468 | | ByVal category As Short, |
| 4 | 2469 | | ByVal rawData As Byte(), |
| 4 | 2470 | | ByVal EntrySeverity As LoggingSeverity) |
| | 2471 | |
|
| 8 | 2472 | | Log( |
| 8 | 2473 | | "", |
| 8 | 2474 | | logName, |
| 8 | 2475 | | source, |
| 8 | 2476 | | message, |
| 8 | 2477 | | eventType, |
| 8 | 2478 | | eventID, |
| 8 | 2479 | | category, |
| 8 | 2480 | | rawData, |
| 8 | 2481 | | EntrySeverity) |
| | 2482 | |
|
| 8 | 2483 | | End Sub |
| | 2484 | |
|
| | 2485 | | ''' <summary> |
| | 2486 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2487 | | ''' </summary> |
| | 2488 | | ''' <param name="logName"> |
| | 2489 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 2490 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 2491 | | ''' </param> |
| | 2492 | | ''' <param name="source"> |
| | 2493 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 2494 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 2495 | | ''' </param> |
| | 2496 | | ''' <param name="message"> |
| | 2497 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2498 | | ''' |
| | 2499 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2500 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2501 | | ''' |
| | 2502 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2503 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2504 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2505 | | ''' </param> |
| | 2506 | | ''' <param name="eventType"> |
| | 2507 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2508 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2509 | | ''' </param> |
| | 2510 | | ''' <param name="eventID"> |
| | 2511 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2512 | | ''' </param> |
| | 2513 | | ''' <param name="category"> |
| | 2514 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2515 | | ''' </param> |
| | 2516 | | ''' <param name="rawData"> |
| | 2517 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2518 | | ''' </param> |
| | 2519 | | ''' <remarks> |
| | 2520 | | ''' <para> |
| | 2521 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2522 | | ''' </para> |
| | 2523 | | ''' <para> |
| | 2524 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2525 | | ''' </para> |
| | 2526 | | ''' </remarks> |
| 72 | 2527 | | Public Sub Log( |
| 72 | 2528 | | ByVal machineName As String, |
| 72 | 2529 | | ByVal logName As String, |
| 72 | 2530 | | ByVal source As String, |
| 72 | 2531 | | ByVal message As String, |
| 72 | 2532 | | ByVal eventType As EventLogEntryType, |
| 72 | 2533 | | ByVal eventID As Integer, |
| 72 | 2534 | | ByVal category As Short, |
| 72 | 2535 | | ByVal rawData As Byte()) |
| | 2536 | |
|
| 144 | 2537 | | Initialize() |
| 144 | 2538 | | Log( |
| 144 | 2539 | | machineName, |
| 144 | 2540 | | logName, |
| 144 | 2541 | | source, |
| 144 | 2542 | | message, |
| 144 | 2543 | | eventType, |
| 144 | 2544 | | eventID, |
| 144 | 2545 | | category, |
| 144 | 2546 | | rawData, |
| 144 | 2547 | | MaxKilobytes) |
| | 2548 | |
|
| 144 | 2549 | | End Sub |
| | 2550 | |
|
| | 2551 | | ''' <summary> |
| | 2552 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2553 | | ''' </summary> |
| | 2554 | | ''' <param name="logName"> |
| | 2555 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 2556 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 2557 | | ''' </param> |
| | 2558 | | ''' <param name="source"> |
| | 2559 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 2560 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 2561 | | ''' </param> |
| | 2562 | | ''' <param name="message"> |
| | 2563 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2564 | | ''' |
| | 2565 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2566 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2567 | | ''' |
| | 2568 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2569 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2570 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2571 | | ''' </param> |
| | 2572 | | ''' <param name="eventType"> |
| | 2573 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2574 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2575 | | ''' </param> |
| | 2576 | | ''' <param name="eventID"> |
| | 2577 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2578 | | ''' </param> |
| | 2579 | | ''' <param name="category"> |
| | 2580 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2581 | | ''' </param> |
| | 2582 | | ''' <param name="rawData"> |
| | 2583 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2584 | | ''' </param> |
| | 2585 | | ''' <param name="EntrySeverity"> |
| | 2586 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 2587 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 2588 | | ''' will be skipped and not written to the Event Log. |
| | 2589 | | ''' </param> |
| | 2590 | | ''' <remarks> |
| | 2591 | | ''' <para> |
| | 2592 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2593 | | ''' </para> |
| | 2594 | | ''' <para> |
| | 2595 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2596 | | ''' </para> |
| | 2597 | | ''' </remarks> |
| 84 | 2598 | | Public Sub Log( |
| 84 | 2599 | | ByVal machineName As String, |
| 84 | 2600 | | ByVal logName As String, |
| 84 | 2601 | | ByVal source As String, |
| 84 | 2602 | | ByVal message As String, |
| 84 | 2603 | | ByVal eventType As EventLogEntryType, |
| 84 | 2604 | | ByVal eventID As Integer, |
| 84 | 2605 | | ByVal category As Short, |
| 84 | 2606 | | ByVal rawData As Byte(), |
| 84 | 2607 | | ByVal EntrySeverity As LoggingSeverity) |
| | 2608 | |
|
| 168 | 2609 | | Initialize() |
| 168 | 2610 | | Log( |
| 168 | 2611 | | machineName, |
| 168 | 2612 | | logName, |
| 168 | 2613 | | source, |
| 168 | 2614 | | message, |
| 168 | 2615 | | eventType, |
| 168 | 2616 | | eventID, |
| 168 | 2617 | | category, |
| 168 | 2618 | | rawData, |
| 168 | 2619 | | MaxKilobytes, |
| 168 | 2620 | | EntrySeverity) |
| | 2621 | |
|
| 168 | 2622 | | End Sub |
| | 2623 | |
|
| | 2624 | | ''' <summary> |
| | 2625 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2626 | | ''' </summary> |
| | 2627 | | ''' <param name="logName"> |
| | 2628 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 2629 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 2630 | | ''' </param> |
| | 2631 | | ''' <param name="source"> |
| | 2632 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 2633 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 2634 | | ''' </param> |
| | 2635 | | ''' <param name="message"> |
| | 2636 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2637 | | ''' |
| | 2638 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2639 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2640 | | ''' |
| | 2641 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2642 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2643 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2644 | | ''' </param> |
| | 2645 | | ''' <param name="eventType"> |
| | 2646 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2647 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2648 | | ''' </param> |
| | 2649 | | ''' <param name="eventID"> |
| | 2650 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2651 | | ''' </param> |
| | 2652 | | ''' <param name="category"> |
| | 2653 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2654 | | ''' </param> |
| | 2655 | | ''' <param name="rawData"> |
| | 2656 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2657 | | ''' </param> |
| | 2658 | | ''' <param name="maxKilobytes"> |
| | 2659 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 2660 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 2661 | | ''' </param> |
| | 2662 | | ''' <remarks> |
| | 2663 | | ''' <para> |
| | 2664 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2665 | | ''' </para> |
| | 2666 | | ''' <para> |
| | 2667 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2668 | | ''' </para> |
| | 2669 | | ''' </remarks> |
| 72 | 2670 | | Public Sub Log( |
| 72 | 2671 | | ByVal machineName As String, |
| 72 | 2672 | | ByVal logName As String, |
| 72 | 2673 | | ByVal source As String, |
| 72 | 2674 | | ByVal message As String, |
| 72 | 2675 | | ByVal eventType As EventLogEntryType, |
| 72 | 2676 | | ByVal eventID As Integer, |
| 72 | 2677 | | ByVal category As Short, |
| 72 | 2678 | | ByVal rawData As Byte(), |
| 72 | 2679 | | ByVal maxKilobytes As Integer) |
| | 2680 | |
|
| 144 | 2681 | | Initialize() |
| 144 | 2682 | | Log( |
| 144 | 2683 | | machineName, |
| 144 | 2684 | | logName, |
| 144 | 2685 | | source, |
| 144 | 2686 | | message, |
| 144 | 2687 | | eventType, |
| 144 | 2688 | | eventID, |
| 144 | 2689 | | category, |
| 144 | 2690 | | rawData, |
| 144 | 2691 | | maxKilobytes, |
| 144 | 2692 | | RetentionDays) |
| | 2693 | |
|
| 144 | 2694 | | End Sub |
| | 2695 | |
|
| | 2696 | | ''' <summary> |
| | 2697 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2698 | | ''' </summary> |
| | 2699 | | ''' <param name="logName"> |
| | 2700 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 2701 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 2702 | | ''' </param> |
| | 2703 | | ''' <param name="source"> |
| | 2704 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 2705 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 2706 | | ''' </param> |
| | 2707 | | ''' <param name="message"> |
| | 2708 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2709 | | ''' |
| | 2710 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2711 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2712 | | ''' |
| | 2713 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2714 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2715 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2716 | | ''' </param> |
| | 2717 | | ''' <param name="eventType"> |
| | 2718 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2719 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2720 | | ''' </param> |
| | 2721 | | ''' <param name="eventID"> |
| | 2722 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2723 | | ''' </param> |
| | 2724 | | ''' <param name="category"> |
| | 2725 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 2726 | | ''' </param> |
| | 2727 | | ''' <param name="rawData"> |
| | 2728 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 2729 | | ''' </param> |
| | 2730 | | ''' <param name="maxKilobytes"> |
| | 2731 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 2732 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 2733 | | ''' </param> |
| | 2734 | | ''' <param name="EntrySeverity"> |
| | 2735 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 2736 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 2737 | | ''' will be skipped and not written to the Event Log. |
| | 2738 | | ''' </param> |
| | 2739 | | ''' <remarks> |
| | 2740 | | ''' <para> |
| | 2741 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2742 | | ''' </para> |
| | 2743 | | ''' <para> |
| | 2744 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2745 | | ''' </para> |
| | 2746 | | ''' </remarks> |
| 84 | 2747 | | Public Sub Log( |
| 84 | 2748 | | ByVal machineName As String, |
| 84 | 2749 | | ByVal logName As String, |
| 84 | 2750 | | ByVal source As String, |
| 84 | 2751 | | ByVal message As String, |
| 84 | 2752 | | ByVal eventType As EventLogEntryType, |
| 84 | 2753 | | ByVal eventID As Integer, |
| 84 | 2754 | | ByVal category As Short, |
| 84 | 2755 | | ByVal rawData As Byte(), |
| 84 | 2756 | | ByVal maxKilobytes As Integer, |
| 84 | 2757 | | ByVal EntrySeverity As LoggingSeverity) |
| | 2758 | |
|
| 168 | 2759 | | Initialize() |
| 168 | 2760 | | Log( |
| 168 | 2761 | | machineName, |
| 168 | 2762 | | logName, |
| 168 | 2763 | | source, |
| 168 | 2764 | | message, |
| 168 | 2765 | | eventType, |
| 168 | 2766 | | eventID, |
| 168 | 2767 | | category, |
| 168 | 2768 | | rawData, |
| 168 | 2769 | | maxKilobytes, |
| 168 | 2770 | | RetentionDays, |
| 168 | 2771 | | EntrySeverity) |
| | 2772 | |
|
| 168 | 2773 | | End Sub |
| | 2774 | |
|
| | 2775 | | ''' <summary> |
| | 2776 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2777 | | ''' </summary> |
| | 2778 | | ''' <param name="message"> |
| | 2779 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2780 | | ''' |
| | 2781 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2782 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2783 | | ''' |
| | 2784 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2785 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2786 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2787 | | ''' </param> |
| | 2788 | | ''' <param name="maxKilobytes"> |
| | 2789 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 2790 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 2791 | | ''' </param> |
| | 2792 | | ''' <param name="retentionDays"> |
| | 2793 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 2794 | | ''' Only used when creating a new log. |
| | 2795 | | ''' </param> |
| | 2796 | | ''' <remarks> |
| | 2797 | | ''' <para> |
| | 2798 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2799 | | ''' </para> |
| | 2800 | | ''' <para> |
| | 2801 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2802 | | ''' </para> |
| | 2803 | | ''' </remarks> |
| 4 | 2804 | | Public Sub Log( |
| 4 | 2805 | | ByVal message As String, |
| 4 | 2806 | | ByVal maxKilobytes As Integer, |
| 4 | 2807 | | ByVal retentionDays As Integer) |
| | 2808 | |
|
| 8 | 2809 | | Log( |
| 8 | 2810 | | message, |
| 8 | 2811 | | EventLogEntryType.Information, |
| 8 | 2812 | | maxKilobytes, |
| 8 | 2813 | | retentionDays) |
| | 2814 | |
|
| 8 | 2815 | | End Sub |
| | 2816 | |
|
| | 2817 | | ''' <summary> |
| | 2818 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2819 | | ''' </summary> |
| | 2820 | | ''' <param name="message"> |
| | 2821 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2822 | | ''' |
| | 2823 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2824 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2825 | | ''' |
| | 2826 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2827 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2828 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2829 | | ''' </param> |
| | 2830 | | ''' <param name="maxKilobytes"> |
| | 2831 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 2832 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 2833 | | ''' </param> |
| | 2834 | | ''' <param name="retentionDays"> |
| | 2835 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 2836 | | ''' Only used when creating a new log. |
| | 2837 | | ''' </param> |
| | 2838 | | ''' <param name="EntrySeverity"> |
| | 2839 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 2840 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 2841 | | ''' will be skipped and not written to the Event Log. |
| | 2842 | | ''' </param> |
| | 2843 | | ''' <remarks> |
| | 2844 | | ''' <para> |
| | 2845 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2846 | | ''' </para> |
| | 2847 | | ''' <para> |
| | 2848 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2849 | | ''' </para> |
| | 2850 | | ''' </remarks> |
| 4 | 2851 | | Public Sub Log( |
| 4 | 2852 | | ByVal message As String, |
| 4 | 2853 | | ByVal maxKilobytes As Integer, |
| 4 | 2854 | | ByVal retentionDays As Integer, |
| 4 | 2855 | | ByVal EntrySeverity As LoggingSeverity) |
| | 2856 | |
|
| 8 | 2857 | | Log( |
| 8 | 2858 | | message, |
| 8 | 2859 | | EventLogEntryType.Information, |
| 8 | 2860 | | maxKilobytes, |
| 8 | 2861 | | retentionDays, |
| 8 | 2862 | | EntrySeverity) |
| | 2863 | |
|
| 8 | 2864 | | End Sub |
| | 2865 | |
|
| | 2866 | | ''' <summary> |
| | 2867 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2868 | | ''' </summary> |
| | 2869 | | ''' <param name="message"> |
| | 2870 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2871 | | ''' |
| | 2872 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2873 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2874 | | ''' |
| | 2875 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2876 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2877 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2878 | | ''' </param> |
| | 2879 | | ''' <param name="eventType"> |
| | 2880 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2881 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2882 | | ''' </param> |
| | 2883 | | ''' <param name="maxKilobytes"> |
| | 2884 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 2885 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 2886 | | ''' </param> |
| | 2887 | | ''' <param name="retentionDays"> |
| | 2888 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 2889 | | ''' Only used when creating a new log. |
| | 2890 | | ''' </param> |
| | 2891 | | ''' <remarks> |
| | 2892 | | ''' <para> |
| | 2893 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2894 | | ''' </para> |
| | 2895 | | ''' <para> |
| | 2896 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2897 | | ''' </para> |
| | 2898 | | ''' </remarks> |
| 4 | 2899 | | Public Sub Log( |
| 4 | 2900 | | ByVal message As String, |
| 4 | 2901 | | ByVal eventType As EventLogEntryType, |
| 4 | 2902 | | ByVal maxKilobytes As Integer, |
| 4 | 2903 | | ByVal retentionDays As Integer) |
| | 2904 | |
|
| 8 | 2905 | | Log( |
| 8 | 2906 | | message, |
| 8 | 2907 | | eventType, |
| 8 | 2908 | | 0, |
| 8 | 2909 | | maxKilobytes, |
| 8 | 2910 | | retentionDays) |
| | 2911 | |
|
| 8 | 2912 | | End Sub |
| | 2913 | |
|
| | 2914 | | ''' <summary> |
| | 2915 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2916 | | ''' </summary> |
| | 2917 | | ''' <param name="message"> |
| | 2918 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2919 | | ''' |
| | 2920 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2921 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2922 | | ''' |
| | 2923 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2924 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2925 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2926 | | ''' </param> |
| | 2927 | | ''' <param name="eventType"> |
| | 2928 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2929 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2930 | | ''' </param> |
| | 2931 | | ''' <param name="maxKilobytes"> |
| | 2932 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 2933 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 2934 | | ''' </param> |
| | 2935 | | ''' <param name="retentionDays"> |
| | 2936 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 2937 | | ''' Only used when creating a new log. |
| | 2938 | | ''' </param> |
| | 2939 | | ''' <param name="EntrySeverity"> |
| | 2940 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 2941 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 2942 | | ''' will be skipped and not written to the Event Log. |
| | 2943 | | ''' </param> |
| | 2944 | | ''' <remarks> |
| | 2945 | | ''' <para> |
| | 2946 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 2947 | | ''' </para> |
| | 2948 | | ''' <para> |
| | 2949 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 2950 | | ''' </para> |
| | 2951 | | ''' </remarks> |
| 4 | 2952 | | Public Sub Log( |
| 4 | 2953 | | ByVal message As String, |
| 4 | 2954 | | ByVal eventType As EventLogEntryType, |
| 4 | 2955 | | ByVal maxKilobytes As Integer, |
| 4 | 2956 | | ByVal retentionDays As Integer, |
| 4 | 2957 | | ByVal EntrySeverity As LoggingSeverity) |
| | 2958 | |
|
| 8 | 2959 | | Log( |
| 8 | 2960 | | message, |
| 8 | 2961 | | eventType, |
| 8 | 2962 | | 0, |
| 8 | 2963 | | maxKilobytes, |
| 8 | 2964 | | retentionDays, |
| 8 | 2965 | | EntrySeverity) |
| | 2966 | |
|
| 8 | 2967 | | End Sub |
| | 2968 | |
|
| | 2969 | | ''' <summary> |
| | 2970 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 2971 | | ''' </summary> |
| | 2972 | | ''' <param name="message"> |
| | 2973 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 2974 | | ''' |
| | 2975 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 2976 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 2977 | | ''' |
| | 2978 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 2979 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 2980 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 2981 | | ''' </param> |
| | 2982 | | ''' <param name="eventType"> |
| | 2983 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 2984 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 2985 | | ''' </param> |
| | 2986 | | ''' <param name="eventID"> |
| | 2987 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 2988 | | ''' </param> |
| | 2989 | | ''' <param name="maxKilobytes"> |
| | 2990 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 2991 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 2992 | | ''' </param> |
| | 2993 | | ''' <param name="retentionDays"> |
| | 2994 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 2995 | | ''' Only used when creating a new log. |
| | 2996 | | ''' </param> |
| | 2997 | | ''' <remarks> |
| | 2998 | | ''' <para> |
| | 2999 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3000 | | ''' </para> |
| | 3001 | | ''' <para> |
| | 3002 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3003 | | ''' </para> |
| | 3004 | | ''' </remarks> |
| 4 | 3005 | | Public Sub Log( |
| 4 | 3006 | | ByVal message As String, |
| 4 | 3007 | | ByVal eventType As EventLogEntryType, |
| 4 | 3008 | | ByVal eventID As Integer, |
| 4 | 3009 | | ByVal maxKilobytes As Integer, |
| 4 | 3010 | | ByVal retentionDays As Integer) |
| | 3011 | |
|
| 8 | 3012 | | Log( |
| 8 | 3013 | | message, |
| 8 | 3014 | | eventType, |
| 8 | 3015 | | eventID, |
| 8 | 3016 | | 0, |
| 8 | 3017 | | maxKilobytes, |
| 8 | 3018 | | retentionDays) |
| | 3019 | |
|
| 8 | 3020 | | End Sub |
| | 3021 | |
|
| | 3022 | | ''' <summary> |
| | 3023 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3024 | | ''' </summary> |
| | 3025 | | ''' <param name="message"> |
| | 3026 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3027 | | ''' |
| | 3028 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3029 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3030 | | ''' |
| | 3031 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3032 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3033 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3034 | | ''' </param> |
| | 3035 | | ''' <param name="eventType"> |
| | 3036 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3037 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3038 | | ''' </param> |
| | 3039 | | ''' <param name="eventID"> |
| | 3040 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3041 | | ''' </param> |
| | 3042 | | ''' <param name="maxKilobytes"> |
| | 3043 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3044 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3045 | | ''' </param> |
| | 3046 | | ''' <param name="retentionDays"> |
| | 3047 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3048 | | ''' Only used when creating a new log. |
| | 3049 | | ''' </param> |
| | 3050 | | ''' <param name="EntrySeverity"> |
| | 3051 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 3052 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 3053 | | ''' will be skipped and not written to the Event Log. |
| | 3054 | | ''' </param> |
| | 3055 | | ''' <remarks> |
| | 3056 | | ''' <para> |
| | 3057 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3058 | | ''' </para> |
| | 3059 | | ''' <para> |
| | 3060 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3061 | | ''' </para> |
| | 3062 | | ''' </remarks> |
| 4 | 3063 | | Public Sub Log( |
| 4 | 3064 | | ByVal message As String, |
| 4 | 3065 | | ByVal eventType As EventLogEntryType, |
| 4 | 3066 | | ByVal eventID As Integer, |
| 4 | 3067 | | ByVal maxKilobytes As Integer, |
| 4 | 3068 | | ByVal retentionDays As Integer, |
| 4 | 3069 | | ByVal EntrySeverity As LoggingSeverity) |
| | 3070 | |
|
| 8 | 3071 | | Log( |
| 8 | 3072 | | message, |
| 8 | 3073 | | eventType, |
| 8 | 3074 | | eventID, |
| 8 | 3075 | | 0, |
| 8 | 3076 | | maxKilobytes, |
| 8 | 3077 | | retentionDays, |
| 8 | 3078 | | EntrySeverity) |
| | 3079 | |
|
| 8 | 3080 | | End Sub |
| | 3081 | |
|
| | 3082 | | ''' <summary> |
| | 3083 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3084 | | ''' </summary> |
| | 3085 | | ''' <param name="message"> |
| | 3086 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3087 | | ''' |
| | 3088 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3089 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3090 | | ''' |
| | 3091 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3092 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3093 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3094 | | ''' </param> |
| | 3095 | | ''' <param name="eventType"> |
| | 3096 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3097 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3098 | | ''' </param> |
| | 3099 | | ''' <param name="eventID"> |
| | 3100 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3101 | | ''' </param> |
| | 3102 | | ''' <param name="category"> |
| | 3103 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3104 | | ''' </param> |
| | 3105 | | ''' <param name="maxKilobytes"> |
| | 3106 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3107 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3108 | | ''' </param> |
| | 3109 | | ''' <param name="retentionDays"> |
| | 3110 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3111 | | ''' Only used when creating a new log. |
| | 3112 | | ''' </param> |
| | 3113 | | ''' <remarks> |
| | 3114 | | ''' <para> |
| | 3115 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3116 | | ''' </para> |
| | 3117 | | ''' <para> |
| | 3118 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3119 | | ''' </para> |
| | 3120 | | ''' </remarks> |
| 4 | 3121 | | Public Sub Log( |
| 4 | 3122 | | ByVal message As String, |
| 4 | 3123 | | ByVal eventType As EventLogEntryType, |
| 4 | 3124 | | ByVal eventID As Integer, |
| 4 | 3125 | | ByVal category As Short, |
| 4 | 3126 | | ByVal maxKilobytes As Integer, |
| 4 | 3127 | | ByVal retentionDays As Integer) |
| | 3128 | |
|
| 8 | 3129 | | Log( |
| 8 | 3130 | | message, |
| 8 | 3131 | | eventType, |
| 8 | 3132 | | eventID, |
| 8 | 3133 | | category, |
| 8 | 3134 | | Nothing, |
| 8 | 3135 | | maxKilobytes, |
| 8 | 3136 | | retentionDays) |
| | 3137 | |
|
| 8 | 3138 | | End Sub |
| | 3139 | |
|
| | 3140 | | ''' <summary> |
| | 3141 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3142 | | ''' </summary> |
| | 3143 | | ''' <param name="message"> |
| | 3144 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3145 | | ''' |
| | 3146 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3147 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3148 | | ''' |
| | 3149 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3150 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3151 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3152 | | ''' </param> |
| | 3153 | | ''' <param name="eventType"> |
| | 3154 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3155 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3156 | | ''' </param> |
| | 3157 | | ''' <param name="eventID"> |
| | 3158 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3159 | | ''' </param> |
| | 3160 | | ''' <param name="category"> |
| | 3161 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3162 | | ''' </param> |
| | 3163 | | ''' <param name="maxKilobytes"> |
| | 3164 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3165 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3166 | | ''' </param> |
| | 3167 | | ''' <param name="retentionDays"> |
| | 3168 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3169 | | ''' Only used when creating a new log. |
| | 3170 | | ''' </param> |
| | 3171 | | ''' <param name="EntrySeverity"> |
| | 3172 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 3173 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 3174 | | ''' will be skipped and not written to the Event Log. |
| | 3175 | | ''' </param> |
| | 3176 | | ''' <remarks> |
| | 3177 | | ''' <para> |
| | 3178 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3179 | | ''' </para> |
| | 3180 | | ''' <para> |
| | 3181 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3182 | | ''' </para> |
| | 3183 | | ''' </remarks> |
| 4 | 3184 | | Public Sub Log( |
| 4 | 3185 | | ByVal message As String, |
| 4 | 3186 | | ByVal eventType As EventLogEntryType, |
| 4 | 3187 | | ByVal eventID As Integer, |
| 4 | 3188 | | ByVal category As Short, |
| 4 | 3189 | | ByVal maxKilobytes As Integer, |
| 4 | 3190 | | ByVal retentionDays As Integer, |
| 4 | 3191 | | ByVal EntrySeverity As LoggingSeverity) |
| | 3192 | |
|
| 8 | 3193 | | Log( |
| 8 | 3194 | | message, |
| 8 | 3195 | | eventType, |
| 8 | 3196 | | eventID, |
| 8 | 3197 | | category, |
| 8 | 3198 | | Nothing, |
| 8 | 3199 | | maxKilobytes, |
| 8 | 3200 | | retentionDays, |
| 8 | 3201 | | EntrySeverity) |
| | 3202 | |
|
| 8 | 3203 | | End Sub |
| | 3204 | |
|
| | 3205 | | ''' <summary> |
| | 3206 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3207 | | ''' </summary> |
| | 3208 | | ''' <param name="message"> |
| | 3209 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3210 | | ''' |
| | 3211 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3212 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3213 | | ''' |
| | 3214 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3215 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3216 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3217 | | ''' </param> |
| | 3218 | | ''' <param name="eventType"> |
| | 3219 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3220 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3221 | | ''' </param> |
| | 3222 | | ''' <param name="eventID"> |
| | 3223 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3224 | | ''' </param> |
| | 3225 | | ''' <param name="category"> |
| | 3226 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3227 | | ''' </param> |
| | 3228 | | ''' <param name="rawData"> |
| | 3229 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 3230 | | ''' </param> |
| | 3231 | | ''' <param name="maxKilobytes"> |
| | 3232 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3233 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3234 | | ''' </param> |
| | 3235 | | ''' <param name="retentionDays"> |
| | 3236 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3237 | | ''' Only used when creating a new log. |
| | 3238 | | ''' </param> |
| | 3239 | | ''' <remarks> |
| | 3240 | | ''' <para> |
| | 3241 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3242 | | ''' </para> |
| | 3243 | | ''' <para> |
| | 3244 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3245 | | ''' </para> |
| | 3246 | | ''' </remarks> |
| 4 | 3247 | | Public Sub Log( |
| 4 | 3248 | | ByVal message As String, |
| 4 | 3249 | | ByVal eventType As EventLogEntryType, |
| 4 | 3250 | | ByVal eventID As Integer, |
| 4 | 3251 | | ByVal category As Short, |
| 4 | 3252 | | ByVal rawData As Byte(), |
| 4 | 3253 | | ByVal maxKilobytes As Integer, |
| 4 | 3254 | | ByVal retentionDays As Integer) |
| | 3255 | |
|
| 8 | 3256 | | Log( |
| 8 | 3257 | | "", |
| 8 | 3258 | | message, |
| 8 | 3259 | | eventType, |
| 8 | 3260 | | eventID, |
| 8 | 3261 | | category, |
| 8 | 3262 | | rawData, |
| 8 | 3263 | | maxKilobytes, |
| 8 | 3264 | | retentionDays) |
| | 3265 | |
|
| 8 | 3266 | | End Sub |
| | 3267 | |
|
| | 3268 | | ''' <summary> |
| | 3269 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3270 | | ''' </summary> |
| | 3271 | | ''' <param name="message"> |
| | 3272 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3273 | | ''' |
| | 3274 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3275 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3276 | | ''' |
| | 3277 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3278 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3279 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3280 | | ''' </param> |
| | 3281 | | ''' <param name="eventType"> |
| | 3282 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3283 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3284 | | ''' </param> |
| | 3285 | | ''' <param name="eventID"> |
| | 3286 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3287 | | ''' </param> |
| | 3288 | | ''' <param name="category"> |
| | 3289 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3290 | | ''' </param> |
| | 3291 | | ''' <param name="rawData"> |
| | 3292 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 3293 | | ''' </param> |
| | 3294 | | ''' <param name="maxKilobytes"> |
| | 3295 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3296 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3297 | | ''' </param> |
| | 3298 | | ''' <param name="retentionDays"> |
| | 3299 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3300 | | ''' Only used when creating a new log. |
| | 3301 | | ''' </param> |
| | 3302 | | ''' <param name="EntrySeverity"> |
| | 3303 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 3304 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 3305 | | ''' will be skipped and not written to the Event Log. |
| | 3306 | | ''' </param> |
| | 3307 | | ''' <remarks> |
| | 3308 | | ''' <para> |
| | 3309 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3310 | | ''' </para> |
| | 3311 | | ''' <para> |
| | 3312 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3313 | | ''' </para> |
| | 3314 | | ''' </remarks> |
| 4 | 3315 | | Public Sub Log( |
| 4 | 3316 | | ByVal message As String, |
| 4 | 3317 | | ByVal eventType As EventLogEntryType, |
| 4 | 3318 | | ByVal eventID As Integer, |
| 4 | 3319 | | ByVal category As Short, |
| 4 | 3320 | | ByVal rawData As Byte(), |
| 4 | 3321 | | ByVal maxKilobytes As Integer, |
| 4 | 3322 | | ByVal retentionDays As Integer, |
| 4 | 3323 | | ByVal EntrySeverity As LoggingSeverity) |
| | 3324 | |
|
| 8 | 3325 | | Log( |
| 8 | 3326 | | "", |
| 8 | 3327 | | message, |
| 8 | 3328 | | eventType, |
| 8 | 3329 | | eventID, |
| 8 | 3330 | | category, |
| 8 | 3331 | | rawData, |
| 8 | 3332 | | maxKilobytes, |
| 8 | 3333 | | retentionDays, |
| 8 | 3334 | | EntrySeverity) |
| | 3335 | |
|
| 8 | 3336 | | End Sub |
| | 3337 | |
|
| | 3338 | | ''' <summary> |
| | 3339 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3340 | | ''' </summary> |
| | 3341 | | ''' <param name="source"> |
| | 3342 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 3343 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 3344 | | ''' </param> |
| | 3345 | | ''' <param name="message"> |
| | 3346 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3347 | | ''' |
| | 3348 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3349 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3350 | | ''' |
| | 3351 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3352 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3353 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3354 | | ''' </param> |
| | 3355 | | ''' <param name="eventType"> |
| | 3356 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3357 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3358 | | ''' </param> |
| | 3359 | | ''' <param name="eventID"> |
| | 3360 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3361 | | ''' </param> |
| | 3362 | | ''' <param name="category"> |
| | 3363 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3364 | | ''' </param> |
| | 3365 | | ''' <param name="rawData"> |
| | 3366 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 3367 | | ''' </param> |
| | 3368 | | ''' <param name="maxKilobytes"> |
| | 3369 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3370 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3371 | | ''' </param> |
| | 3372 | | ''' <param name="retentionDays"> |
| | 3373 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3374 | | ''' Only used when creating a new log. |
| | 3375 | | ''' </param> |
| | 3376 | | ''' <remarks> |
| | 3377 | | ''' <para> |
| | 3378 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3379 | | ''' </para> |
| | 3380 | | ''' <para> |
| | 3381 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3382 | | ''' </para> |
| | 3383 | | ''' </remarks> |
| 4 | 3384 | | Public Sub Log( |
| 4 | 3385 | | ByVal source As String, |
| 4 | 3386 | | ByVal message As String, |
| 4 | 3387 | | ByVal eventType As EventLogEntryType, |
| 4 | 3388 | | ByVal eventID As Integer, |
| 4 | 3389 | | ByVal category As Short, |
| 4 | 3390 | | ByVal rawData As Byte(), |
| 4 | 3391 | | ByVal maxKilobytes As Integer, |
| 4 | 3392 | | ByVal retentionDays As Integer) |
| | 3393 | |
|
| 8 | 3394 | | Log( |
| 8 | 3395 | | "", |
| 8 | 3396 | | source, |
| 8 | 3397 | | message, |
| 8 | 3398 | | eventType, |
| 8 | 3399 | | eventID, |
| 8 | 3400 | | category, |
| 8 | 3401 | | rawData, |
| 8 | 3402 | | maxKilobytes, |
| 8 | 3403 | | retentionDays) |
| | 3404 | |
|
| 8 | 3405 | | End Sub |
| | 3406 | |
|
| | 3407 | | ''' <summary> |
| | 3408 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3409 | | ''' </summary> |
| | 3410 | | ''' <param name="source"> |
| | 3411 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 3412 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 3413 | | ''' </param> |
| | 3414 | | ''' <param name="message"> |
| | 3415 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3416 | | ''' |
| | 3417 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3418 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3419 | | ''' |
| | 3420 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3421 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3422 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3423 | | ''' </param> |
| | 3424 | | ''' <param name="eventType"> |
| | 3425 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3426 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3427 | | ''' </param> |
| | 3428 | | ''' <param name="eventID"> |
| | 3429 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3430 | | ''' </param> |
| | 3431 | | ''' <param name="category"> |
| | 3432 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3433 | | ''' </param> |
| | 3434 | | ''' <param name="rawData"> |
| | 3435 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 3436 | | ''' </param> |
| | 3437 | | ''' <param name="maxKilobytes"> |
| | 3438 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3439 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3440 | | ''' </param> |
| | 3441 | | ''' <param name="retentionDays"> |
| | 3442 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3443 | | ''' Only used when creating a new log. |
| | 3444 | | ''' </param> |
| | 3445 | | ''' <param name="EntrySeverity"> |
| | 3446 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 3447 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 3448 | | ''' will be skipped and not written to the Event Log. |
| | 3449 | | ''' </param> |
| | 3450 | | ''' <remarks> |
| | 3451 | | ''' <para> |
| | 3452 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3453 | | ''' </para> |
| | 3454 | | ''' <para> |
| | 3455 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3456 | | ''' </para> |
| | 3457 | | ''' </remarks> |
| 4 | 3458 | | Public Sub Log( |
| 4 | 3459 | | ByVal source As String, |
| 4 | 3460 | | ByVal message As String, |
| 4 | 3461 | | ByVal eventType As EventLogEntryType, |
| 4 | 3462 | | ByVal eventID As Integer, |
| 4 | 3463 | | ByVal category As Short, |
| 4 | 3464 | | ByVal rawData As Byte(), |
| 4 | 3465 | | ByVal maxKilobytes As Integer, |
| 4 | 3466 | | ByVal retentionDays As Integer, |
| 4 | 3467 | | ByVal EntrySeverity As LoggingSeverity) |
| | 3468 | |
|
| 8 | 3469 | | Log( |
| 8 | 3470 | | "", |
| 8 | 3471 | | source, |
| 8 | 3472 | | message, |
| 8 | 3473 | | eventType, |
| 8 | 3474 | | eventID, |
| 8 | 3475 | | category, |
| 8 | 3476 | | rawData, |
| 8 | 3477 | | maxKilobytes, |
| 8 | 3478 | | retentionDays, |
| 8 | 3479 | | EntrySeverity) |
| | 3480 | |
|
| 8 | 3481 | | End Sub |
| | 3482 | |
|
| | 3483 | | ''' <summary> |
| | 3484 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3485 | | ''' </summary> |
| | 3486 | | ''' <param name="logName"> |
| | 3487 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 3488 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 3489 | | ''' </param> |
| | 3490 | | ''' <param name="source"> |
| | 3491 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 3492 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 3493 | | ''' </param> |
| | 3494 | | ''' <param name="message"> |
| | 3495 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3496 | | ''' |
| | 3497 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3498 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3499 | | ''' |
| | 3500 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3501 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3502 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3503 | | ''' </param> |
| | 3504 | | ''' <param name="eventType"> |
| | 3505 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3506 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3507 | | ''' </param> |
| | 3508 | | ''' <param name="eventID"> |
| | 3509 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3510 | | ''' </param> |
| | 3511 | | ''' <param name="category"> |
| | 3512 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3513 | | ''' </param> |
| | 3514 | | ''' <param name="rawData"> |
| | 3515 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 3516 | | ''' </param> |
| | 3517 | | ''' <param name="maxKilobytes"> |
| | 3518 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3519 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3520 | | ''' </param> |
| | 3521 | | ''' <param name="retentionDays"> |
| | 3522 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3523 | | ''' Only used when creating a new log. |
| | 3524 | | ''' </param> |
| | 3525 | | ''' <remarks> |
| | 3526 | | ''' <para> |
| | 3527 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3528 | | ''' </para> |
| | 3529 | | ''' <para> |
| | 3530 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3531 | | ''' </para> |
| | 3532 | | ''' </remarks> |
| 4 | 3533 | | Public Sub Log( |
| 4 | 3534 | | ByVal logName As String, |
| 4 | 3535 | | ByVal source As String, |
| 4 | 3536 | | ByVal message As String, |
| 4 | 3537 | | ByVal eventType As EventLogEntryType, |
| 4 | 3538 | | ByVal eventID As Integer, |
| 4 | 3539 | | ByVal category As Short, |
| 4 | 3540 | | ByVal rawData As Byte(), |
| 4 | 3541 | | ByVal maxKilobytes As Integer, |
| 4 | 3542 | | ByVal retentionDays As Integer) |
| | 3543 | |
|
| 8 | 3544 | | Log( |
| 8 | 3545 | | "", |
| 8 | 3546 | | logName, |
| 8 | 3547 | | source, |
| 8 | 3548 | | message, |
| 8 | 3549 | | eventType, |
| 8 | 3550 | | eventID, |
| 8 | 3551 | | category, |
| 8 | 3552 | | rawData, |
| 8 | 3553 | | maxKilobytes, |
| 8 | 3554 | | retentionDays) |
| | 3555 | |
|
| 8 | 3556 | | End Sub |
| | 3557 | |
|
| | 3558 | | ''' <summary> |
| | 3559 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3560 | | ''' </summary> |
| | 3561 | | ''' <param name="logName"> |
| | 3562 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 3563 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 3564 | | ''' </param> |
| | 3565 | | ''' <param name="source"> |
| | 3566 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 3567 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 3568 | | ''' </param> |
| | 3569 | | ''' <param name="message"> |
| | 3570 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3571 | | ''' |
| | 3572 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3573 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3574 | | ''' |
| | 3575 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3576 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3577 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3578 | | ''' </param> |
| | 3579 | | ''' <param name="eventType"> |
| | 3580 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3581 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3582 | | ''' </param> |
| | 3583 | | ''' <param name="eventID"> |
| | 3584 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3585 | | ''' </param> |
| | 3586 | | ''' <param name="category"> |
| | 3587 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3588 | | ''' </param> |
| | 3589 | | ''' <param name="rawData"> |
| | 3590 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 3591 | | ''' </param> |
| | 3592 | | ''' <param name="maxKilobytes"> |
| | 3593 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3594 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3595 | | ''' </param> |
| | 3596 | | ''' <param name="retentionDays"> |
| | 3597 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3598 | | ''' Only used when creating a new log. |
| | 3599 | | ''' </param> |
| | 3600 | | ''' <param name="EntrySeverity"> |
| | 3601 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 3602 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 3603 | | ''' will be skipped and not written to the Event Log. |
| | 3604 | | ''' </param> |
| | 3605 | | ''' <remarks> |
| | 3606 | | ''' <para> |
| | 3607 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3608 | | ''' </para> |
| | 3609 | | ''' <para> |
| | 3610 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3611 | | ''' </para> |
| | 3612 | | ''' </remarks> |
| 4 | 3613 | | Public Sub Log( |
| 4 | 3614 | | ByVal logName As String, |
| 4 | 3615 | | ByVal source As String, |
| 4 | 3616 | | ByVal message As String, |
| 4 | 3617 | | ByVal eventType As EventLogEntryType, |
| 4 | 3618 | | ByVal eventID As Integer, |
| 4 | 3619 | | ByVal category As Short, |
| 4 | 3620 | | ByVal rawData As Byte(), |
| 4 | 3621 | | ByVal maxKilobytes As Integer, |
| 4 | 3622 | | ByVal retentionDays As Integer, |
| 4 | 3623 | | ByVal EntrySeverity As LoggingSeverity) |
| | 3624 | |
|
| 8 | 3625 | | Log( |
| 8 | 3626 | | "", |
| 8 | 3627 | | logName, |
| 8 | 3628 | | source, |
| 8 | 3629 | | message, |
| 8 | 3630 | | eventType, |
| 8 | 3631 | | eventID, |
| 8 | 3632 | | category, |
| 8 | 3633 | | rawData, |
| 8 | 3634 | | maxKilobytes, |
| 8 | 3635 | | retentionDays, |
| 8 | 3636 | | EntrySeverity) |
| | 3637 | |
|
| 8 | 3638 | | End Sub |
| | 3639 | |
|
| | 3640 | | ''' <summary> |
| | 3641 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3642 | | ''' </summary> |
| | 3643 | | ''' <param name="logName"> |
| | 3644 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 3645 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 3646 | | ''' </param> |
| | 3647 | | ''' <param name="source"> |
| | 3648 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 3649 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 3650 | | ''' </param> |
| | 3651 | | ''' <param name="message"> |
| | 3652 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3653 | | ''' |
| | 3654 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3655 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3656 | | ''' |
| | 3657 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3658 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3659 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3660 | | ''' </param> |
| | 3661 | | ''' <param name="eventType"> |
| | 3662 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3663 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3664 | | ''' </param> |
| | 3665 | | ''' <param name="eventID"> |
| | 3666 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3667 | | ''' </param> |
| | 3668 | | ''' <param name="category"> |
| | 3669 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3670 | | ''' </param> |
| | 3671 | | ''' <param name="rawData"> |
| | 3672 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 3673 | | ''' </param> |
| | 3674 | | ''' <param name="maxKilobytes"> |
| | 3675 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3676 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3677 | | ''' </param> |
| | 3678 | | ''' <param name="retentionDays"> |
| | 3679 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3680 | | ''' Only used when creating a new log. |
| | 3681 | | ''' </param> |
| | 3682 | | ''' <remarks> |
| | 3683 | | ''' <para> |
| | 3684 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3685 | | ''' </para> |
| | 3686 | | ''' <para> |
| | 3687 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3688 | | ''' </para> |
| | 3689 | | ''' </remarks> |
| 76 | 3690 | | Public Sub Log( |
| 76 | 3691 | | ByVal machineName As String, |
| 76 | 3692 | | ByVal logName As String, |
| 76 | 3693 | | ByVal source As String, |
| 76 | 3694 | | ByVal message As String, |
| 76 | 3695 | | ByVal eventType As EventLogEntryType, |
| 76 | 3696 | | ByVal eventID As Integer, |
| 76 | 3697 | | ByVal category As Short, |
| 76 | 3698 | | ByVal rawData As Byte(), |
| 76 | 3699 | | ByVal maxKilobytes As Integer, |
| 76 | 3700 | | ByVal retentionDays As Integer) |
| | 3701 | |
|
| 152 | 3702 | | Initialize() |
| | 3703 | |
|
| 152 | 3704 | | Log( |
| 152 | 3705 | | machineName, |
| 152 | 3706 | | logName, |
| 152 | 3707 | | source, |
| 152 | 3708 | | message, |
| 152 | 3709 | | eventType, |
| 152 | 3710 | | eventID, |
| 152 | 3711 | | category, |
| 152 | 3712 | | rawData, |
| 152 | 3713 | | maxKilobytes, |
| 152 | 3714 | | retentionDays, |
| 152 | 3715 | | WriteInitEntry) |
| | 3716 | |
|
| 152 | 3717 | | End Sub |
| | 3718 | |
|
| | 3719 | | ''' <summary> |
| | 3720 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3721 | | ''' </summary> |
| | 3722 | | ''' <param name="logName"> |
| | 3723 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 3724 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 3725 | | ''' </param> |
| | 3726 | | ''' <param name="source"> |
| | 3727 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 3728 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 3729 | | ''' </param> |
| | 3730 | | ''' <param name="message"> |
| | 3731 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3732 | | ''' |
| | 3733 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3734 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3735 | | ''' |
| | 3736 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3737 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3738 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3739 | | ''' </param> |
| | 3740 | | ''' <param name="eventType"> |
| | 3741 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3742 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3743 | | ''' </param> |
| | 3744 | | ''' <param name="eventID"> |
| | 3745 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 3746 | | ''' </param> |
| | 3747 | | ''' <param name="category"> |
| | 3748 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 3749 | | ''' </param> |
| | 3750 | | ''' <param name="rawData"> |
| | 3751 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 3752 | | ''' </param> |
| | 3753 | | ''' <param name="maxKilobytes"> |
| | 3754 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3755 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3756 | | ''' </param> |
| | 3757 | | ''' <param name="retentionDays"> |
| | 3758 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3759 | | ''' Only used when creating a new log. |
| | 3760 | | ''' </param> |
| | 3761 | | ''' <param name="EntrySeverity"> |
| | 3762 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 3763 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 3764 | | ''' will be skipped and not written to the Event Log. |
| | 3765 | | ''' </param> |
| | 3766 | | ''' <remarks> |
| | 3767 | | ''' <para> |
| | 3768 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3769 | | ''' </para> |
| | 3770 | | ''' <para> |
| | 3771 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3772 | | ''' </para> |
| | 3773 | | ''' </remarks> |
| 88 | 3774 | | Public Sub Log( |
| 88 | 3775 | | ByVal machineName As String, |
| 88 | 3776 | | ByVal logName As String, |
| 88 | 3777 | | ByVal source As String, |
| 88 | 3778 | | ByVal message As String, |
| 88 | 3779 | | ByVal eventType As EventLogEntryType, |
| 88 | 3780 | | ByVal eventID As Integer, |
| 88 | 3781 | | ByVal category As Short, |
| 88 | 3782 | | ByVal rawData As Byte(), |
| 88 | 3783 | | ByVal maxKilobytes As Integer, |
| 88 | 3784 | | ByVal retentionDays As Integer, |
| 88 | 3785 | | ByVal EntrySeverity As LoggingSeverity) |
| | 3786 | |
|
| 176 | 3787 | | Initialize() |
| 176 | 3788 | | Log( |
| 176 | 3789 | | machineName, |
| 176 | 3790 | | logName, |
| 176 | 3791 | | source, |
| 176 | 3792 | | message, |
| 176 | 3793 | | eventType, |
| 176 | 3794 | | eventID, |
| 176 | 3795 | | category, |
| 176 | 3796 | | rawData, |
| 176 | 3797 | | maxKilobytes, |
| 176 | 3798 | | retentionDays, |
| 176 | 3799 | | WriteInitEntry, |
| 176 | 3800 | | EntrySeverity) |
| | 3801 | |
|
| 176 | 3802 | | End Sub |
| | 3803 | |
|
| | 3804 | | ''' <summary> |
| | 3805 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3806 | | ''' </summary> |
| | 3807 | | ''' <param name="message"> |
| | 3808 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3809 | | ''' |
| | 3810 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3811 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3812 | | ''' |
| | 3813 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3814 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3815 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3816 | | ''' </param> |
| | 3817 | | ''' <param name="maxKilobytes"> |
| | 3818 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3819 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3820 | | ''' </param> |
| | 3821 | | ''' <param name="retentionDays"> |
| | 3822 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3823 | | ''' Only used when creating a new log. |
| | 3824 | | ''' </param> |
| | 3825 | | ''' <param name="writeInitEntry"> |
| | 3826 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 3827 | | ''' </param> |
| | 3828 | | ''' <remarks> |
| | 3829 | | ''' <para> |
| | 3830 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3831 | | ''' </para> |
| | 3832 | | ''' <para> |
| | 3833 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3834 | | ''' </para> |
| | 3835 | | ''' </remarks> |
| 4 | 3836 | | Public Sub Log( |
| 4 | 3837 | | ByVal message As String, |
| 4 | 3838 | | ByVal maxKilobytes As Integer, |
| 4 | 3839 | | ByVal retentionDays As Integer, |
| 4 | 3840 | | ByVal writeInitEntry As Boolean) |
| | 3841 | |
|
| 8 | 3842 | | Log( |
| 8 | 3843 | | message, |
| 8 | 3844 | | EventLogEntryType.Information, |
| 8 | 3845 | | maxKilobytes, |
| 8 | 3846 | | retentionDays, |
| 8 | 3847 | | writeInitEntry) |
| | 3848 | |
|
| 8 | 3849 | | End Sub |
| | 3850 | |
|
| | 3851 | | ''' <summary> |
| | 3852 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3853 | | ''' </summary> |
| | 3854 | | ''' <param name="message"> |
| | 3855 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3856 | | ''' |
| | 3857 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3858 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3859 | | ''' |
| | 3860 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3861 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3862 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3863 | | ''' </param> |
| | 3864 | | ''' <param name="maxKilobytes"> |
| | 3865 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3866 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3867 | | ''' </param> |
| | 3868 | | ''' <param name="retentionDays"> |
| | 3869 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3870 | | ''' Only used when creating a new log. |
| | 3871 | | ''' </param> |
| | 3872 | | ''' <param name="writeInitEntry"> |
| | 3873 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 3874 | | ''' </param> |
| | 3875 | | ''' <param name="EntrySeverity"> |
| | 3876 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 3877 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 3878 | | ''' will be skipped and not written to the Event Log. |
| | 3879 | | ''' </param> |
| | 3880 | | ''' <remarks> |
| | 3881 | | ''' <para> |
| | 3882 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3883 | | ''' </para> |
| | 3884 | | ''' <para> |
| | 3885 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3886 | | ''' </para> |
| | 3887 | | ''' </remarks> |
| 4 | 3888 | | Public Sub Log( |
| 4 | 3889 | | ByVal message As String, |
| 4 | 3890 | | ByVal maxKilobytes As Integer, |
| 4 | 3891 | | ByVal retentionDays As Integer, |
| 4 | 3892 | | ByVal writeInitEntry As Boolean, |
| 4 | 3893 | | ByVal EntrySeverity As LoggingSeverity) |
| | 3894 | |
|
| 8 | 3895 | | Log( |
| 8 | 3896 | | message, |
| 8 | 3897 | | EventLogEntryType.Information, |
| 8 | 3898 | | maxKilobytes, |
| 8 | 3899 | | retentionDays, |
| 8 | 3900 | | writeInitEntry, |
| 8 | 3901 | | EntrySeverity) |
| | 3902 | |
|
| 8 | 3903 | | End Sub |
| | 3904 | |
|
| | 3905 | | ''' <summary> |
| | 3906 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3907 | | ''' </summary> |
| | 3908 | | ''' <param name="message"> |
| | 3909 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3910 | | ''' |
| | 3911 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3912 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3913 | | ''' |
| | 3914 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3915 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3916 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3917 | | ''' </param> |
| | 3918 | | ''' <param name="eventType"> |
| | 3919 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3920 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3921 | | ''' </param> |
| | 3922 | | ''' <param name="maxKilobytes"> |
| | 3923 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3924 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3925 | | ''' </param> |
| | 3926 | | ''' <param name="retentionDays"> |
| | 3927 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3928 | | ''' Only used when creating a new log. |
| | 3929 | | ''' </param> |
| | 3930 | | ''' <param name="writeInitEntry"> |
| | 3931 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 3932 | | ''' </param> |
| | 3933 | | ''' <remarks> |
| | 3934 | | ''' <para> |
| | 3935 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3936 | | ''' </para> |
| | 3937 | | ''' <para> |
| | 3938 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3939 | | ''' </para> |
| | 3940 | | ''' </remarks> |
| 4 | 3941 | | Public Sub Log( |
| 4 | 3942 | | ByVal message As String, |
| 4 | 3943 | | ByVal eventType As EventLogEntryType, |
| 4 | 3944 | | ByVal maxKilobytes As Integer, |
| 4 | 3945 | | ByVal retentionDays As Integer, |
| 4 | 3946 | | ByVal writeInitEntry As Boolean) |
| | 3947 | |
|
| 8 | 3948 | | Log( |
| 8 | 3949 | | message, |
| 8 | 3950 | | eventType, |
| 8 | 3951 | | 0, |
| 8 | 3952 | | maxKilobytes, |
| 8 | 3953 | | retentionDays, |
| 8 | 3954 | | writeInitEntry) |
| | 3955 | |
|
| 8 | 3956 | | End Sub |
| | 3957 | |
|
| | 3958 | | ''' <summary> |
| | 3959 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 3960 | | ''' </summary> |
| | 3961 | | ''' <param name="message"> |
| | 3962 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 3963 | | ''' |
| | 3964 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 3965 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 3966 | | ''' |
| | 3967 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 3968 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 3969 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 3970 | | ''' </param> |
| | 3971 | | ''' <param name="eventType"> |
| | 3972 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 3973 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 3974 | | ''' </param> |
| | 3975 | | ''' <param name="maxKilobytes"> |
| | 3976 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 3977 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 3978 | | ''' </param> |
| | 3979 | | ''' <param name="retentionDays"> |
| | 3980 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 3981 | | ''' Only used when creating a new log. |
| | 3982 | | ''' </param> |
| | 3983 | | ''' <param name="writeInitEntry"> |
| | 3984 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 3985 | | ''' </param> |
| | 3986 | | ''' <param name="EntrySeverity"> |
| | 3987 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 3988 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 3989 | | ''' will be skipped and not written to the Event Log. |
| | 3990 | | ''' </param> |
| | 3991 | | ''' <remarks> |
| | 3992 | | ''' <para> |
| | 3993 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 3994 | | ''' </para> |
| | 3995 | | ''' <para> |
| | 3996 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 3997 | | ''' </para> |
| | 3998 | | ''' </remarks> |
| 4 | 3999 | | Public Sub Log( |
| 4 | 4000 | | ByVal message As String, |
| 4 | 4001 | | ByVal eventType As EventLogEntryType, |
| 4 | 4002 | | ByVal maxKilobytes As Integer, |
| 4 | 4003 | | ByVal retentionDays As Integer, |
| 4 | 4004 | | ByVal writeInitEntry As Boolean, |
| 4 | 4005 | | ByVal EntrySeverity As LoggingSeverity) |
| | 4006 | |
|
| 8 | 4007 | | Log( |
| 8 | 4008 | | message, |
| 8 | 4009 | | eventType, |
| 8 | 4010 | | 0, |
| 8 | 4011 | | maxKilobytes, |
| 8 | 4012 | | retentionDays, |
| 8 | 4013 | | writeInitEntry, |
| 8 | 4014 | | EntrySeverity) |
| | 4015 | |
|
| 8 | 4016 | | End Sub |
| | 4017 | |
|
| | 4018 | | ''' <summary> |
| | 4019 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4020 | | ''' </summary> |
| | 4021 | | ''' <param name="message"> |
| | 4022 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4023 | | ''' |
| | 4024 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4025 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4026 | | ''' |
| | 4027 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4028 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4029 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4030 | | ''' </param> |
| | 4031 | | ''' <param name="eventType"> |
| | 4032 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4033 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4034 | | ''' </param> |
| | 4035 | | ''' <param name="eventID"> |
| | 4036 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4037 | | ''' </param> |
| | 4038 | | ''' <param name="maxKilobytes"> |
| | 4039 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4040 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4041 | | ''' </param> |
| | 4042 | | ''' <param name="retentionDays"> |
| | 4043 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4044 | | ''' Only used when creating a new log. |
| | 4045 | | ''' </param> |
| | 4046 | | ''' <param name="writeInitEntry"> |
| | 4047 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4048 | | ''' </param> |
| | 4049 | | ''' <remarks> |
| | 4050 | | ''' <para> |
| | 4051 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4052 | | ''' </para> |
| | 4053 | | ''' <para> |
| | 4054 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4055 | | ''' </para> |
| | 4056 | | ''' </remarks> |
| 4 | 4057 | | Public Sub Log( |
| 4 | 4058 | | ByVal message As String, |
| 4 | 4059 | | ByVal eventType As EventLogEntryType, |
| 4 | 4060 | | ByVal eventID As Integer, |
| 4 | 4061 | | ByVal maxKilobytes As Integer, |
| 4 | 4062 | | ByVal retentionDays As Integer, |
| 4 | 4063 | | ByVal writeInitEntry As Boolean) |
| | 4064 | |
|
| 8 | 4065 | | Log( |
| 8 | 4066 | | message, |
| 8 | 4067 | | eventType, |
| 8 | 4068 | | eventID, |
| 8 | 4069 | | 0, |
| 8 | 4070 | | maxKilobytes, |
| 8 | 4071 | | retentionDays, |
| 8 | 4072 | | writeInitEntry) |
| | 4073 | |
|
| 8 | 4074 | | End Sub |
| | 4075 | |
|
| | 4076 | | ''' <summary> |
| | 4077 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4078 | | ''' </summary> |
| | 4079 | | ''' <param name="message"> |
| | 4080 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4081 | | ''' |
| | 4082 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4083 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4084 | | ''' |
| | 4085 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4086 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4087 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4088 | | ''' </param> |
| | 4089 | | ''' <param name="eventType"> |
| | 4090 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4091 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4092 | | ''' </param> |
| | 4093 | | ''' <param name="eventID"> |
| | 4094 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4095 | | ''' </param> |
| | 4096 | | ''' <param name="maxKilobytes"> |
| | 4097 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4098 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4099 | | ''' </param> |
| | 4100 | | ''' <param name="retentionDays"> |
| | 4101 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4102 | | ''' Only used when creating a new log. |
| | 4103 | | ''' </param> |
| | 4104 | | ''' <param name="writeInitEntry"> |
| | 4105 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4106 | | ''' </param> |
| | 4107 | | ''' <param name="EntrySeverity"> |
| | 4108 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 4109 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 4110 | | ''' will be skipped and not written to the Event Log. |
| | 4111 | | ''' </param> |
| | 4112 | | ''' <remarks> |
| | 4113 | | ''' <para> |
| | 4114 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4115 | | ''' </para> |
| | 4116 | | ''' <para> |
| | 4117 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4118 | | ''' </para> |
| | 4119 | | ''' </remarks> |
| 4 | 4120 | | Public Sub Log( |
| 4 | 4121 | | ByVal message As String, |
| 4 | 4122 | | ByVal eventType As EventLogEntryType, |
| 4 | 4123 | | ByVal eventID As Integer, |
| 4 | 4124 | | ByVal maxKilobytes As Integer, |
| 4 | 4125 | | ByVal retentionDays As Integer, |
| 4 | 4126 | | ByVal writeInitEntry As Boolean, |
| 4 | 4127 | | ByVal EntrySeverity As LoggingSeverity) |
| | 4128 | |
|
| 8 | 4129 | | Log( |
| 8 | 4130 | | message, |
| 8 | 4131 | | eventType, |
| 8 | 4132 | | eventID, |
| 8 | 4133 | | 0, |
| 8 | 4134 | | maxKilobytes, |
| 8 | 4135 | | retentionDays, |
| 8 | 4136 | | writeInitEntry, |
| 8 | 4137 | | EntrySeverity) |
| | 4138 | |
|
| 8 | 4139 | | End Sub |
| | 4140 | |
|
| | 4141 | | ''' <summary> |
| | 4142 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4143 | | ''' </summary> |
| | 4144 | | ''' <param name="message"> |
| | 4145 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4146 | | ''' |
| | 4147 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4148 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4149 | | ''' |
| | 4150 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4151 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4152 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4153 | | ''' </param> |
| | 4154 | | ''' <param name="eventType"> |
| | 4155 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4156 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4157 | | ''' </param> |
| | 4158 | | ''' <param name="eventID"> |
| | 4159 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4160 | | ''' </param> |
| | 4161 | | ''' <param name="category"> |
| | 4162 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 4163 | | ''' </param> |
| | 4164 | | ''' <param name="maxKilobytes"> |
| | 4165 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4166 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4167 | | ''' </param> |
| | 4168 | | ''' <param name="retentionDays"> |
| | 4169 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4170 | | ''' Only used when creating a new log. |
| | 4171 | | ''' </param> |
| | 4172 | | ''' <param name="writeInitEntry"> |
| | 4173 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4174 | | ''' </param> |
| | 4175 | | ''' <remarks> |
| | 4176 | | ''' <para> |
| | 4177 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4178 | | ''' </para> |
| | 4179 | | ''' <para> |
| | 4180 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4181 | | ''' </para> |
| | 4182 | | ''' </remarks> |
| 4 | 4183 | | Public Sub Log( |
| 4 | 4184 | | ByVal message As String, |
| 4 | 4185 | | ByVal eventType As EventLogEntryType, |
| 4 | 4186 | | ByVal eventID As Integer, |
| 4 | 4187 | | ByVal category As Short, |
| 4 | 4188 | | ByVal maxKilobytes As Integer, |
| 4 | 4189 | | ByVal retentionDays As Integer, |
| 4 | 4190 | | ByVal writeInitEntry As Boolean) |
| | 4191 | |
|
| 8 | 4192 | | Log( |
| 8 | 4193 | | message, |
| 8 | 4194 | | eventType, |
| 8 | 4195 | | eventID, |
| 8 | 4196 | | category, |
| 8 | 4197 | | Nothing, |
| 8 | 4198 | | maxKilobytes, |
| 8 | 4199 | | retentionDays, |
| 8 | 4200 | | writeInitEntry) |
| | 4201 | |
|
| 8 | 4202 | | End Sub |
| | 4203 | |
|
| | 4204 | | ''' <summary> |
| | 4205 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4206 | | ''' </summary> |
| | 4207 | | ''' <param name="message"> |
| | 4208 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4209 | | ''' |
| | 4210 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4211 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4212 | | ''' |
| | 4213 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4214 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4215 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4216 | | ''' </param> |
| | 4217 | | ''' <param name="eventType"> |
| | 4218 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4219 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4220 | | ''' </param> |
| | 4221 | | ''' <param name="eventID"> |
| | 4222 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4223 | | ''' </param> |
| | 4224 | | ''' <param name="category"> |
| | 4225 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 4226 | | ''' </param> |
| | 4227 | | ''' <param name="maxKilobytes"> |
| | 4228 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4229 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4230 | | ''' </param> |
| | 4231 | | ''' <param name="retentionDays"> |
| | 4232 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4233 | | ''' Only used when creating a new log. |
| | 4234 | | ''' </param> |
| | 4235 | | ''' <param name="writeInitEntry"> |
| | 4236 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4237 | | ''' </param> |
| | 4238 | | ''' <param name="EntrySeverity"> |
| | 4239 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 4240 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 4241 | | ''' will be skipped and not written to the Event Log. |
| | 4242 | | ''' </param> |
| | 4243 | | ''' <remarks> |
| | 4244 | | ''' <para> |
| | 4245 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4246 | | ''' </para> |
| | 4247 | | ''' <para> |
| | 4248 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4249 | | ''' </para> |
| | 4250 | | ''' </remarks> |
| 4 | 4251 | | Public Sub Log( |
| 4 | 4252 | | ByVal message As String, |
| 4 | 4253 | | ByVal eventType As EventLogEntryType, |
| 4 | 4254 | | ByVal eventID As Integer, |
| 4 | 4255 | | ByVal category As Short, |
| 4 | 4256 | | ByVal maxKilobytes As Integer, |
| 4 | 4257 | | ByVal retentionDays As Integer, |
| 4 | 4258 | | ByVal writeInitEntry As Boolean, |
| 4 | 4259 | | ByVal EntrySeverity As LoggingSeverity) |
| | 4260 | |
|
| 8 | 4261 | | Log( |
| 8 | 4262 | | message, |
| 8 | 4263 | | eventType, |
| 8 | 4264 | | eventID, |
| 8 | 4265 | | category, |
| 8 | 4266 | | Nothing, |
| 8 | 4267 | | maxKilobytes, |
| 8 | 4268 | | retentionDays, |
| 8 | 4269 | | writeInitEntry, |
| 8 | 4270 | | EntrySeverity) |
| | 4271 | |
|
| 8 | 4272 | | End Sub |
| | 4273 | |
|
| | 4274 | | ''' <summary> |
| | 4275 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4276 | | ''' </summary> |
| | 4277 | | ''' <param name="message"> |
| | 4278 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4279 | | ''' |
| | 4280 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4281 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4282 | | ''' |
| | 4283 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4284 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4285 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4286 | | ''' </param> |
| | 4287 | | ''' <param name="eventType"> |
| | 4288 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4289 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4290 | | ''' </param> |
| | 4291 | | ''' <param name="eventID"> |
| | 4292 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4293 | | ''' </param> |
| | 4294 | | ''' <param name="category"> |
| | 4295 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 4296 | | ''' </param> |
| | 4297 | | ''' <param name="rawData"> |
| | 4298 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 4299 | | ''' </param> |
| | 4300 | | ''' <param name="maxKilobytes"> |
| | 4301 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4302 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4303 | | ''' </param> |
| | 4304 | | ''' <param name="retentionDays"> |
| | 4305 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4306 | | ''' Only used when creating a new log. |
| | 4307 | | ''' </param> |
| | 4308 | | ''' <param name="writeInitEntry"> |
| | 4309 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4310 | | ''' </param> |
| | 4311 | | ''' <remarks> |
| | 4312 | | ''' <para> |
| | 4313 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4314 | | ''' </para> |
| | 4315 | | ''' <para> |
| | 4316 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4317 | | ''' </para> |
| | 4318 | | ''' </remarks> |
| 4 | 4319 | | Public Sub Log( |
| 4 | 4320 | | ByVal message As String, |
| 4 | 4321 | | ByVal eventType As EventLogEntryType, |
| 4 | 4322 | | ByVal eventID As Integer, |
| 4 | 4323 | | ByVal category As Short, |
| 4 | 4324 | | ByVal rawData As Byte(), |
| 4 | 4325 | | ByVal maxKilobytes As Integer, |
| 4 | 4326 | | ByVal retentionDays As Integer, |
| 4 | 4327 | | ByVal writeInitEntry As Boolean) |
| | 4328 | |
|
| 8 | 4329 | | Log( |
| 8 | 4330 | | "", |
| 8 | 4331 | | message, |
| 8 | 4332 | | eventType, |
| 8 | 4333 | | eventID, |
| 8 | 4334 | | category, |
| 8 | 4335 | | rawData, |
| 8 | 4336 | | maxKilobytes, |
| 8 | 4337 | | retentionDays, |
| 8 | 4338 | | writeInitEntry) |
| | 4339 | |
|
| 8 | 4340 | | End Sub |
| | 4341 | |
|
| | 4342 | | ''' <summary> |
| | 4343 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4344 | | ''' </summary> |
| | 4345 | | ''' <param name="message"> |
| | 4346 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4347 | | ''' |
| | 4348 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4349 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4350 | | ''' |
| | 4351 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4352 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4353 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4354 | | ''' </param> |
| | 4355 | | ''' <param name="eventType"> |
| | 4356 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4357 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4358 | | ''' </param> |
| | 4359 | | ''' <param name="eventID"> |
| | 4360 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4361 | | ''' </param> |
| | 4362 | | ''' <param name="category"> |
| | 4363 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 4364 | | ''' </param> |
| | 4365 | | ''' <param name="rawData"> |
| | 4366 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 4367 | | ''' </param> |
| | 4368 | | ''' <param name="maxKilobytes"> |
| | 4369 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4370 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4371 | | ''' </param> |
| | 4372 | | ''' <param name="retentionDays"> |
| | 4373 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4374 | | ''' Only used when creating a new log. |
| | 4375 | | ''' </param> |
| | 4376 | | ''' <param name="writeInitEntry"> |
| | 4377 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4378 | | ''' </param> |
| | 4379 | | ''' <param name="EntrySeverity"> |
| | 4380 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 4381 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 4382 | | ''' will be skipped and not written to the Event Log. |
| | 4383 | | ''' </param> |
| | 4384 | | ''' <remarks> |
| | 4385 | | ''' <para> |
| | 4386 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4387 | | ''' </para> |
| | 4388 | | ''' <para> |
| | 4389 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4390 | | ''' </para> |
| | 4391 | | ''' </remarks> |
| 4 | 4392 | | Public Sub Log( |
| 4 | 4393 | | ByVal message As String, |
| 4 | 4394 | | ByVal eventType As EventLogEntryType, |
| 4 | 4395 | | ByVal eventID As Integer, |
| 4 | 4396 | | ByVal category As Short, |
| 4 | 4397 | | ByVal rawData As Byte(), |
| 4 | 4398 | | ByVal maxKilobytes As Integer, |
| 4 | 4399 | | ByVal retentionDays As Integer, |
| 4 | 4400 | | ByVal writeInitEntry As Boolean, |
| 4 | 4401 | | ByVal EntrySeverity As LoggingSeverity) |
| | 4402 | |
|
| 8 | 4403 | | Log( |
| 8 | 4404 | | "", |
| 8 | 4405 | | message, |
| 8 | 4406 | | eventType, |
| 8 | 4407 | | eventID, |
| 8 | 4408 | | category, |
| 8 | 4409 | | rawData, |
| 8 | 4410 | | maxKilobytes, |
| 8 | 4411 | | retentionDays, |
| 8 | 4412 | | writeInitEntry, |
| 8 | 4413 | | EntrySeverity) |
| | 4414 | |
|
| 8 | 4415 | | End Sub |
| | 4416 | |
|
| | 4417 | | ''' <summary> |
| | 4418 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4419 | | ''' </summary> |
| | 4420 | | ''' <param name="sourceName"> |
| | 4421 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 4422 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 4423 | | ''' </param> |
| | 4424 | | ''' <param name="message"> |
| | 4425 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4426 | | ''' |
| | 4427 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4428 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4429 | | ''' |
| | 4430 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4431 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4432 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4433 | | ''' </param> |
| | 4434 | | ''' <param name="eventType"> |
| | 4435 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4436 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4437 | | ''' </param> |
| | 4438 | | ''' <param name="eventID"> |
| | 4439 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4440 | | ''' </param> |
| | 4441 | | ''' <param name="category"> |
| | 4442 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 4443 | | ''' </param> |
| | 4444 | | ''' <param name="rawData"> |
| | 4445 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 4446 | | ''' </param> |
| | 4447 | | ''' <param name="maxKilobytes"> |
| | 4448 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4449 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4450 | | ''' </param> |
| | 4451 | | ''' <param name="retentionDays"> |
| | 4452 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4453 | | ''' Only used when creating a new log. |
| | 4454 | | ''' </param> |
| | 4455 | | ''' <param name="writeInitEntry"> |
| | 4456 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4457 | | ''' </param> |
| | 4458 | | ''' <remarks> |
| | 4459 | | ''' <para> |
| | 4460 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4461 | | ''' </para> |
| | 4462 | | ''' <para> |
| | 4463 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4464 | | ''' </para> |
| | 4465 | | ''' </remarks> |
| 4 | 4466 | | Public Sub Log( |
| 4 | 4467 | | ByVal sourceName As String, |
| 4 | 4468 | | ByVal message As String, |
| 4 | 4469 | | ByVal eventType As EventLogEntryType, |
| 4 | 4470 | | ByVal eventID As Integer, |
| 4 | 4471 | | ByVal category As Short, |
| 4 | 4472 | | ByVal rawData As Byte(), |
| 4 | 4473 | | ByVal maxKilobytes As Integer, |
| 4 | 4474 | | ByVal retentionDays As Integer, |
| 4 | 4475 | | ByVal writeInitEntry As Boolean) |
| | 4476 | |
|
| 8 | 4477 | | Log( |
| 8 | 4478 | | "", |
| 8 | 4479 | | sourceName, |
| 8 | 4480 | | message, |
| 8 | 4481 | | eventType, |
| 8 | 4482 | | eventID, |
| 8 | 4483 | | category, |
| 8 | 4484 | | rawData, |
| 8 | 4485 | | maxKilobytes, |
| 8 | 4486 | | retentionDays, |
| 8 | 4487 | | writeInitEntry) |
| | 4488 | |
|
| 8 | 4489 | | End Sub |
| | 4490 | |
|
| | 4491 | | ''' <summary> |
| | 4492 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4493 | | ''' </summary> |
| | 4494 | | ''' <param name="sourceName"> |
| | 4495 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 4496 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 4497 | | ''' </param> |
| | 4498 | | ''' <param name="message"> |
| | 4499 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4500 | | ''' |
| | 4501 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4502 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4503 | | ''' |
| | 4504 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4505 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4506 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4507 | | ''' </param> |
| | 4508 | | ''' <param name="eventType"> |
| | 4509 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4510 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4511 | | ''' </param> |
| | 4512 | | ''' <param name="eventID"> |
| | 4513 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4514 | | ''' </param> |
| | 4515 | | ''' <param name="category"> |
| | 4516 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 4517 | | ''' </param> |
| | 4518 | | ''' <param name="rawData"> |
| | 4519 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 4520 | | ''' </param> |
| | 4521 | | ''' <param name="maxKilobytes"> |
| | 4522 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4523 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4524 | | ''' </param> |
| | 4525 | | ''' <param name="retentionDays"> |
| | 4526 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4527 | | ''' Only used when creating a new log. |
| | 4528 | | ''' </param> |
| | 4529 | | ''' <param name="writeInitEntry"> |
| | 4530 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4531 | | ''' </param> |
| | 4532 | | ''' <param name="EntrySeverity"> |
| | 4533 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 4534 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 4535 | | ''' will be skipped and not written to the Event Log. |
| | 4536 | | ''' </param> |
| | 4537 | | ''' <remarks> |
| | 4538 | | ''' <para> |
| | 4539 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4540 | | ''' </para> |
| | 4541 | | ''' <para> |
| | 4542 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4543 | | ''' </para> |
| | 4544 | | ''' </remarks> |
| 4 | 4545 | | Public Sub Log( |
| 4 | 4546 | | ByVal sourceName As String, |
| 4 | 4547 | | ByVal message As String, |
| 4 | 4548 | | ByVal eventType As EventLogEntryType, |
| 4 | 4549 | | ByVal eventID As Integer, |
| 4 | 4550 | | ByVal category As Short, |
| 4 | 4551 | | ByVal rawData As Byte(), |
| 4 | 4552 | | ByVal maxKilobytes As Integer, |
| 4 | 4553 | | ByVal retentionDays As Integer, |
| 4 | 4554 | | ByVal writeInitEntry As Boolean, |
| 4 | 4555 | | ByVal EntrySeverity As LoggingSeverity) |
| | 4556 | |
|
| 8 | 4557 | | Log( |
| 8 | 4558 | | "", |
| 8 | 4559 | | sourceName, |
| 8 | 4560 | | message, |
| 8 | 4561 | | eventType, |
| 8 | 4562 | | eventID, |
| 8 | 4563 | | category, |
| 8 | 4564 | | rawData, |
| 8 | 4565 | | maxKilobytes, |
| 8 | 4566 | | retentionDays, |
| 8 | 4567 | | writeInitEntry, |
| 8 | 4568 | | EntrySeverity) |
| | 4569 | |
|
| 8 | 4570 | | End Sub |
| | 4571 | |
|
| | 4572 | | ''' <summary> |
| | 4573 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4574 | | ''' </summary> |
| | 4575 | | ''' <param name="logName"> |
| | 4576 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 4577 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 4578 | | ''' </param> |
| | 4579 | | ''' <param name="sourceName"> |
| | 4580 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 4581 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 4582 | | ''' </param> |
| | 4583 | | ''' <param name="message"> |
| | 4584 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4585 | | ''' |
| | 4586 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4587 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4588 | | ''' |
| | 4589 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4590 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4591 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4592 | | ''' </param> |
| | 4593 | | ''' <param name="eventType"> |
| | 4594 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4595 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4596 | | ''' </param> |
| | 4597 | | ''' <param name="eventID"> |
| | 4598 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4599 | | ''' </param> |
| | 4600 | | ''' <param name="category"> |
| | 4601 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 4602 | | ''' </param> |
| | 4603 | | ''' <param name="rawData"> |
| | 4604 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 4605 | | ''' </param> |
| | 4606 | | ''' <param name="maxKilobytes"> |
| | 4607 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4608 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4609 | | ''' </param> |
| | 4610 | | ''' <param name="retentionDays"> |
| | 4611 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4612 | | ''' Only used when creating a new log. |
| | 4613 | | ''' </param> |
| | 4614 | | ''' <param name="writeInitEntry"> |
| | 4615 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4616 | | ''' </param> |
| | 4617 | | ''' <remarks> |
| | 4618 | | ''' <para> |
| | 4619 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4620 | | ''' </para> |
| | 4621 | | ''' <para> |
| | 4622 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4623 | | ''' </para> |
| | 4624 | | ''' </remarks> |
| 4 | 4625 | | Public Sub Log( |
| 4 | 4626 | | ByVal logName As String, |
| 4 | 4627 | | ByVal sourceName As String, |
| 4 | 4628 | | ByVal message As String, |
| 4 | 4629 | | ByVal eventType As EventLogEntryType, |
| 4 | 4630 | | ByVal eventID As Integer, |
| 4 | 4631 | | ByVal category As Short, |
| 4 | 4632 | | ByVal rawData As Byte(), |
| 4 | 4633 | | ByVal maxKilobytes As Integer, |
| 4 | 4634 | | ByVal retentionDays As Integer, |
| 4 | 4635 | | ByVal writeInitEntry As Boolean) |
| | 4636 | |
|
| 8 | 4637 | | Log( |
| 8 | 4638 | | "", |
| 8 | 4639 | | logName, |
| 8 | 4640 | | sourceName, |
| 8 | 4641 | | message, |
| 8 | 4642 | | eventType, |
| 8 | 4643 | | eventID, |
| 8 | 4644 | | category, |
| 8 | 4645 | | rawData, |
| 8 | 4646 | | maxKilobytes, |
| 8 | 4647 | | retentionDays, |
| 8 | 4648 | | writeInitEntry) |
| | 4649 | |
|
| 8 | 4650 | | End Sub |
| | 4651 | |
|
| | 4652 | | ''' <summary> |
| | 4653 | | ''' Writes an entry to the Windows Event Log using the provided parameters. |
| | 4654 | | ''' </summary> |
| | 4655 | | ''' <param name="logName"> |
| | 4656 | | ''' The name of the event log to write to (e.g., "Application", "System", or a custom log name). |
| | 4657 | | ''' If <c>null</c> or empty, "Application" is used by default. |
| | 4658 | | ''' </param> |
| | 4659 | | ''' <param name="sourceName"> |
| | 4660 | | ''' The source of the log entry. If <c>null</c> or empty, a default source is generated using the calling method's |
| | 4661 | | ''' namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| | 4662 | | ''' </param> |
| | 4663 | | ''' <param name="message"> |
| | 4664 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4665 | | ''' |
| | 4666 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4667 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4668 | | ''' |
| | 4669 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4670 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4671 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4672 | | ''' </param> |
| | 4673 | | ''' <param name="eventType"> |
| | 4674 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4675 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4676 | | ''' </param> |
| | 4677 | | ''' <param name="eventID"> |
| | 4678 | | ''' The numeric event identifier for the log entry. This is application-defined and may be used to group similar eve |
| | 4679 | | ''' </param> |
| | 4680 | | ''' <param name="category"> |
| | 4681 | | ''' The category for the event, if applicable. This is typically used in categorized event views. |
| | 4682 | | ''' </param> |
| | 4683 | | ''' <param name="rawData"> |
| | 4684 | | ''' Optional binary data to include with the log entry. Can be <c>null</c> if not used. |
| | 4685 | | ''' </param> |
| | 4686 | | ''' <param name="maxKilobytes"> |
| | 4687 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 4688 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 4689 | | ''' </param> |
| | 4690 | | ''' <param name="retentionDays"> |
| | 4691 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 4692 | | ''' Only used when creating a new log. |
| | 4693 | | ''' </param> |
| | 4694 | | ''' <param name="writeInitEntry"> |
| | 4695 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 4696 | | ''' </param> |
| | 4697 | | ''' <param name="EntrySeverity"> |
| | 4698 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 4699 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 4700 | | ''' will be skipped and not written to the Event Log. |
| | 4701 | | ''' </param> |
| | 4702 | | ''' <remarks> |
| | 4703 | | ''' <para> |
| | 4704 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4705 | | ''' </para> |
| | 4706 | | ''' <para> |
| | 4707 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4708 | | ''' </para> |
| | 4709 | | ''' </remarks> |
| 4 | 4710 | | Public Sub Log( |
| 4 | 4711 | | ByVal logName As String, |
| 4 | 4712 | | ByVal sourceName As String, |
| 4 | 4713 | | ByVal message As String, |
| 4 | 4714 | | ByVal eventType As EventLogEntryType, |
| 4 | 4715 | | ByVal eventID As Integer, |
| 4 | 4716 | | ByVal category As Short, |
| 4 | 4717 | | ByVal rawData As Byte(), |
| 4 | 4718 | | ByVal maxKilobytes As Integer, |
| 4 | 4719 | | ByVal retentionDays As Integer, |
| 4 | 4720 | | ByVal writeInitEntry As Boolean, |
| 4 | 4721 | | ByVal EntrySeverity As LoggingSeverity) |
| | 4722 | |
|
| 8 | 4723 | | Log( |
| 8 | 4724 | | "", |
| 8 | 4725 | | logName, |
| 8 | 4726 | | sourceName, |
| 8 | 4727 | | message, |
| 8 | 4728 | | eventType, |
| 8 | 4729 | | eventID, |
| 8 | 4730 | | category, |
| 8 | 4731 | | rawData, |
| 8 | 4732 | | maxKilobytes, |
| 8 | 4733 | | retentionDays, |
| 8 | 4734 | | writeInitEntry, |
| 8 | 4735 | | EntrySeverity) |
| | 4736 | |
|
| 8 | 4737 | | End Sub |
| | 4738 | |
|
| | 4739 | | ''' <summary> |
| | 4740 | | ''' Writes an entry (or entries) to the Windows Event Log using the specified parameters. |
| | 4741 | | ''' </summary> |
| | 4742 | | ''' <param name="targetMachineName"> |
| | 4743 | | ''' The name of the machine where the event log resides. Use <c>"."</c> for the local machine. |
| | 4744 | | ''' If <c>null</c> or empty, the local machine is used by default, or the value of the <see cref="MachineName"/> pro |
| | 4745 | | ''' </param> |
| | 4746 | | ''' <param name="targetLogName"> |
| | 4747 | | ''' The name of the event log (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name). |
| | 4748 | | ''' If <c>null</c> or empty, the value of the <see cref="LogName"/> property is used. |
| | 4749 | | ''' </param> |
| | 4750 | | ''' <param name="sourceName"> |
| | 4751 | | ''' The source name for the event entry. If <c>null</c> or empty, a source is auto-generated from the calling method |
| | 4752 | | ''' If the resulting name exceeds 254 characters, it will be truncated. |
| | 4753 | | ''' </param> |
| | 4754 | | ''' <param name="message"> |
| | 4755 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4756 | | ''' |
| | 4757 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4758 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4759 | | ''' |
| | 4760 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4761 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4762 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4763 | | ''' </param> |
| | 4764 | | ''' <param name="eventType"> |
| | 4765 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4766 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4767 | | ''' </param> |
| | 4768 | | ''' <param name="eventID"> |
| | 4769 | | ''' The numeric event identifier. Application-defined and useful for grouping related events. |
| | 4770 | | ''' </param> |
| | 4771 | | ''' <param name="category"> |
| | 4772 | | ''' The category ID for the event. Use 0 if not applicable. |
| | 4773 | | ''' </param> |
| | 4774 | | ''' <param name="rawData"> |
| | 4775 | | ''' Optional binary data to associate with the event. Can be <c>null</c>. |
| | 4776 | | ''' </param> |
| | 4777 | | ''' <param name="maxKilobytes"> |
| | 4778 | | ''' The maximum size of the event log in kilobytes. Only applies when creating a new log. Range: 64 KB – 4 GB. |
| | 4779 | | ''' </param> |
| | 4780 | | ''' <param name="retentionDays"> |
| | 4781 | | ''' The number of days entries should be retained. 0 means entries are kept indefinitely. |
| | 4782 | | ''' Applies only when creating a new log. |
| | 4783 | | ''' </param> |
| | 4784 | | ''' <param name="writeInitEntry"> |
| | 4785 | | ''' Whether to write an initialization entry when a new log is created. |
| | 4786 | | ''' </param> |
| | 4787 | | ''' <remarks> |
| | 4788 | | ''' <para> |
| | 4789 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4790 | | ''' </para> |
| | 4791 | | ''' <para> |
| | 4792 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4793 | | ''' </para> |
| | 4794 | | ''' </remarks> |
| 80 | 4795 | | Public Sub Log( |
| 80 | 4796 | | ByVal targetMachineName As String, |
| 80 | 4797 | | ByVal targetLogName As String, |
| 80 | 4798 | | ByVal sourceName As String, |
| 80 | 4799 | | ByVal message As String, |
| 80 | 4800 | | ByVal eventType As EventLogEntryType, |
| 80 | 4801 | | ByVal eventID As Integer, |
| 80 | 4802 | | ByVal category As Short, |
| 80 | 4803 | | ByVal rawData As Byte(), |
| 80 | 4804 | | ByVal maxKilobytes As Integer, |
| 80 | 4805 | | ByVal retentionDays As Integer, |
| 80 | 4806 | | ByVal writeInitEntry As Boolean) |
| | 4807 | |
|
| 160 | 4808 | | Initialize() |
| 160 | 4809 | | Log( |
| 160 | 4810 | | targetMachineName, |
| 160 | 4811 | | targetLogName, |
| 160 | 4812 | | sourceName, |
| 160 | 4813 | | message, |
| 160 | 4814 | | eventType, |
| 160 | 4815 | | eventID, |
| 160 | 4816 | | category, |
| 160 | 4817 | | rawData, |
| 160 | 4818 | | maxKilobytes, |
| 160 | 4819 | | retentionDays, |
| 160 | 4820 | | writeInitEntry, |
| 160 | 4821 | | LoggingSeverity) |
| | 4822 | |
|
| 160 | 4823 | | End Sub |
| | 4824 | |
|
| | 4825 | | ''' <summary> |
| | 4826 | | ''' Writes an entry (or entries) to the Windows Event Log using the specified parameters. |
| | 4827 | | ''' </summary> |
| | 4828 | | ''' <param name="targetMachineName"> |
| | 4829 | | ''' The name of the machine where the event log resides. Use <c>"."</c> for the local machine. |
| | 4830 | | ''' If <c>null</c> or empty, the local machine is used by default, or the value of the <see cref="MachineName"/> pro |
| | 4831 | | ''' </param> |
| | 4832 | | ''' <param name="targetLogName"> |
| | 4833 | | ''' The name of the event log (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name). |
| | 4834 | | ''' If <c>null</c> or empty, the value of the <see cref="LogName"/> property is used. |
| | 4835 | | ''' </param> |
| | 4836 | | ''' <param name="sourceName"> |
| | 4837 | | ''' The source name for the event entry. If <c>null</c> or empty, a source is auto-generated from the calling method |
| | 4838 | | ''' If the resulting name exceeds 254 characters, it will be truncated. |
| | 4839 | | ''' </param> |
| | 4840 | | ''' <param name="message"> |
| | 4841 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4842 | | ''' |
| | 4843 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4844 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4845 | | ''' |
| | 4846 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4847 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4848 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4849 | | ''' </param> |
| | 4850 | | ''' <param name="eventType"> |
| | 4851 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 4852 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 4853 | | ''' </param> |
| | 4854 | | ''' <param name="eventID"> |
| | 4855 | | ''' The numeric event identifier. Application-defined and useful for grouping related events. |
| | 4856 | | ''' </param> |
| | 4857 | | ''' <param name="category"> |
| | 4858 | | ''' The category ID for the event. Use 0 if not applicable. |
| | 4859 | | ''' </param> |
| | 4860 | | ''' <param name="rawData"> |
| | 4861 | | ''' Optional binary data to associate with the event. Can be <c>null</c>. |
| | 4862 | | ''' </param> |
| | 4863 | | ''' <param name="maxKilobytes"> |
| | 4864 | | ''' The maximum size of the event log in kilobytes. Only applies when creating a new log. Range: 64 KB – 4 GB. |
| | 4865 | | ''' </param> |
| | 4866 | | ''' <param name="retentionDays"> |
| | 4867 | | ''' The number of days entries should be retained. 0 means entries are kept indefinitely. |
| | 4868 | | ''' Applies only when creating a new log. |
| | 4869 | | ''' </param> |
| | 4870 | | ''' <param name="writeInitEntry"> |
| | 4871 | | ''' Whether to write an initialization entry when a new log is created. |
| | 4872 | | ''' </param> |
| | 4873 | | ''' <param name="EntrySeverity"> |
| | 4874 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 4875 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 4876 | | ''' will be skipped and not written to the Event Log. |
| | 4877 | | ''' </param> |
| | 4878 | | ''' <remarks> |
| | 4879 | | ''' <para> |
| | 4880 | | ''' If the specified event log or source does not exist, they are created automatically using the provided parameter |
| | 4881 | | ''' </para> |
| | 4882 | | ''' <para> |
| | 4883 | | ''' This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnosti |
| | 4884 | | ''' </para> |
| | 4885 | | ''' </remarks> |
| 172 | 4886 | | Public Sub Log( |
| 172 | 4887 | | ByVal targetMachineName As String, |
| 172 | 4888 | | ByVal targetLogName As String, |
| 172 | 4889 | | ByVal sourceName As String, |
| 172 | 4890 | | ByVal message As String, |
| 172 | 4891 | | ByVal eventType As EventLogEntryType, |
| 172 | 4892 | | ByVal eventID As Integer, |
| 172 | 4893 | | ByVal category As Short, |
| 172 | 4894 | | ByVal rawData As Byte(), |
| 172 | 4895 | | ByVal maxKilobytes As Integer, |
| 172 | 4896 | | ByVal retentionDays As Integer, |
| 172 | 4897 | | ByVal writeInitEntry As Boolean, |
| 172 | 4898 | | ByVal EntrySeverity As LoggingSeverity) |
| | 4899 | |
|
| 344 | 4900 | | Initialize() |
| | 4901 | |
|
| 348 | 4902 | | If EntrySeverity < CurrentLoggingLevel Then Exit Sub |
| | 4903 | |
|
| 336 | 4904 | | Dim defaultLog As String = If(String.IsNullOrEmpty(targetLogName), LogName, targetLogName.Trim()) |
| 336 | 4905 | | Dim defaultSource As String = Source(sourceName) |
| 336 | 4906 | | Dim sourceToUse As String = defaultSource ' this is used to tell the process which source to actually use if we |
| 336 | 4907 | | Dim defaultMachine As String = NormalizeMachineName(targetMachineName) |
| | 4908 | |
|
| 336 | 4909 | | Dim finalEventType As EventLogEntryType = NormalizeEventType(eventType) |
| | 4910 | |
|
| 336 | 4911 | | If AllowMultiEntryMessages AndAlso message.Length > 32766 Then |
| 8 | 4912 | | For Each chunk As String In SplitMessageIntoPages(defaultSource, message) |
| 16 | 4913 | | _writer.WriteEntry(defaultMachine, |
| 16 | 4914 | | defaultLog, |
| 16 | 4915 | | sourceToUse, |
| 16 | 4916 | | chunk, |
| 16 | 4917 | | finalEventType, |
| 16 | 4918 | | eventID, |
| 16 | 4919 | | category, |
| 16 | 4920 | | rawData, |
| 16 | 4921 | | maxKilobytes, |
| 16 | 4922 | | retentionDays, |
| 16 | 4923 | | writeInitEntry) |
| 8 | 4924 | | Next |
| 164 | 4925 | | Else |
| 328 | 4926 | | _writer.WriteEntry(defaultMachine, |
| 328 | 4927 | | defaultLog, |
| 328 | 4928 | | sourceToUse, |
| 328 | 4929 | | NormalizeMessage(defaultSource, message), |
| 328 | 4930 | | finalEventType, |
| 328 | 4931 | | eventID, |
| 328 | 4932 | | category, |
| 328 | 4933 | | rawData, |
| 328 | 4934 | | maxKilobytes, |
| 328 | 4935 | | retentionDays, |
| 328 | 4936 | | writeInitEntry) |
| 168 | 4937 | | End If |
| | 4938 | |
|
| 344 | 4939 | | End Sub |
| | 4940 | |
|
| | 4941 | | #End Region |
| | 4942 | |
|
| | 4943 | | #Region " Log Extension Methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
| | 4944 | |
|
| | 4945 | | ''' <summary> |
| | 4946 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 4947 | | ''' </summary> |
| | 4948 | | ''' <param name="eventLog"> |
| | 4949 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 4950 | | ''' with a valid log name and source. |
| | 4951 | | ''' </param> |
| | 4952 | | ''' <param name="message"> |
| | 4953 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4954 | | ''' |
| | 4955 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4956 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4957 | | ''' |
| | 4958 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4959 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4960 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4961 | | ''' </param> |
| | 4962 | | ''' <remarks> |
| | 4963 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 4964 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 4965 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 4966 | | ''' </remarks> |
| | 4967 | | <Extension> |
| 4 | 4968 | | Public Sub LogEntry( |
| 4 | 4969 | | ByVal eventLog As EventLog, |
| 4 | 4970 | | ByVal message As String) |
| | 4971 | |
|
| 8 | 4972 | | LogEntry(eventLog, |
| 8 | 4973 | | message, |
| 8 | 4974 | | EventLogEntryType.Information) |
| | 4975 | |
|
| 8 | 4976 | | End Sub |
| | 4977 | |
|
| | 4978 | | ''' <summary> |
| | 4979 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 4980 | | ''' </summary> |
| | 4981 | | ''' <param name="eventLog"> |
| | 4982 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 4983 | | ''' with a valid log name and source. |
| | 4984 | | ''' </param> |
| | 4985 | | ''' <param name="message"> |
| | 4986 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 4987 | | ''' |
| | 4988 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 4989 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 4990 | | ''' |
| | 4991 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 4992 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 4993 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 4994 | | ''' </param> |
| | 4995 | | ''' <param name="EntrySeverity"> |
| | 4996 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 4997 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 4998 | | ''' will be skipped and not written to the Event Log. |
| | 4999 | | ''' </param> |
| | 5000 | | ''' <remarks> |
| | 5001 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5002 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5003 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5004 | | ''' </remarks> |
| | 5005 | | <Extension> |
| 20 | 5006 | | Public Sub LogEntry( |
| 20 | 5007 | | ByVal eventLog As EventLog, |
| 20 | 5008 | | ByVal message As String, |
| 20 | 5009 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5010 | |
|
| 40 | 5011 | | LogEntry(eventLog, |
| 40 | 5012 | | message, |
| 40 | 5013 | | EventLogEntryType.Information, |
| 40 | 5014 | | EntrySeverity) |
| | 5015 | |
|
| 40 | 5016 | | End Sub |
| | 5017 | |
|
| | 5018 | | ''' <summary> |
| | 5019 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5020 | | ''' </summary> |
| | 5021 | | ''' <param name="eventLog"> |
| | 5022 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5023 | | ''' with a valid log name and source. |
| | 5024 | | ''' </param> |
| | 5025 | | ''' <param name="message"> |
| | 5026 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5027 | | ''' |
| | 5028 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5029 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5030 | | ''' |
| | 5031 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5032 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5033 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5034 | | ''' </param> |
| | 5035 | | ''' <param name="eventType"> |
| | 5036 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5037 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5038 | | ''' </param> |
| | 5039 | | ''' <remarks> |
| | 5040 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5041 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5042 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5043 | | ''' </remarks> |
| | 5044 | | <Extension> |
| 4 | 5045 | | Public Sub LogEntry( |
| 4 | 5046 | | ByVal eventLog As EventLog, |
| 4 | 5047 | | ByVal message As String, |
| 4 | 5048 | | ByVal eventType As EventLogEntryType) |
| | 5049 | |
|
| 8 | 5050 | | LogEntry(eventLog, |
| 8 | 5051 | | message, |
| 8 | 5052 | | eventType, |
| 8 | 5053 | | 0) |
| | 5054 | |
|
| 8 | 5055 | | End Sub |
| | 5056 | |
|
| | 5057 | | ''' <summary> |
| | 5058 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5059 | | ''' </summary> |
| | 5060 | | ''' <param name="eventLog"> |
| | 5061 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5062 | | ''' with a valid log name and source. |
| | 5063 | | ''' </param> |
| | 5064 | | ''' <param name="message"> |
| | 5065 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5066 | | ''' |
| | 5067 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5068 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5069 | | ''' |
| | 5070 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5071 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5072 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5073 | | ''' </param> |
| | 5074 | | ''' <param name="eventType"> |
| | 5075 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5076 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5077 | | ''' </param> |
| | 5078 | | ''' <param name="EntrySeverity"> |
| | 5079 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5080 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5081 | | ''' will be skipped and not written to the Event Log. |
| | 5082 | | ''' </param> |
| | 5083 | | ''' <remarks> |
| | 5084 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5085 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5086 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5087 | | ''' </remarks> |
| | 5088 | | <Extension> |
| 20 | 5089 | | Public Sub LogEntry( |
| 20 | 5090 | | ByVal eventLog As EventLog, |
| 20 | 5091 | | ByVal message As String, |
| 20 | 5092 | | ByVal eventType As EventLogEntryType, |
| 20 | 5093 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5094 | |
|
| 40 | 5095 | | LogEntry(eventLog, |
| 40 | 5096 | | message, |
| 40 | 5097 | | eventType, |
| 40 | 5098 | | 0, |
| 40 | 5099 | | EntrySeverity) |
| | 5100 | |
|
| 40 | 5101 | | End Sub |
| | 5102 | |
|
| | 5103 | | ''' <summary> |
| | 5104 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5105 | | ''' </summary> |
| | 5106 | | ''' <param name="eventLog"> |
| | 5107 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5108 | | ''' with a valid log name and source. |
| | 5109 | | ''' </param> |
| | 5110 | | ''' <param name="message"> |
| | 5111 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5112 | | ''' |
| | 5113 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5114 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5115 | | ''' |
| | 5116 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5117 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5118 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5119 | | ''' </param> |
| | 5120 | | ''' <param name="eventID"> |
| | 5121 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5122 | | ''' or filtering related log entries. |
| | 5123 | | ''' </param> |
| | 5124 | | ''' <remarks> |
| | 5125 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5126 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5127 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5128 | | ''' </remarks> |
| | 5129 | | <Extension> |
| 4 | 5130 | | Public Sub LogEntry( |
| 4 | 5131 | | ByVal eventLog As EventLog, |
| 4 | 5132 | | ByVal message As String, |
| 4 | 5133 | | ByVal eventID As Integer) |
| | 5134 | |
|
| 8 | 5135 | | LogEntry(eventLog, |
| 8 | 5136 | | message, |
| 8 | 5137 | | EventLogEntryType.Information, |
| 8 | 5138 | | eventID) |
| | 5139 | |
|
| 8 | 5140 | | End Sub |
| | 5141 | |
|
| | 5142 | | ''' <summary> |
| | 5143 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5144 | | ''' </summary> |
| | 5145 | | ''' <param name="eventLog"> |
| | 5146 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5147 | | ''' with a valid log name and source. |
| | 5148 | | ''' </param> |
| | 5149 | | ''' <param name="message"> |
| | 5150 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5151 | | ''' |
| | 5152 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5153 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5154 | | ''' |
| | 5155 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5156 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5157 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5158 | | ''' </param> |
| | 5159 | | ''' <param name="eventID"> |
| | 5160 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5161 | | ''' or filtering related log entries. |
| | 5162 | | ''' </param> |
| | 5163 | | ''' <param name="EntrySeverity"> |
| | 5164 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5165 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5166 | | ''' will be skipped and not written to the Event Log. |
| | 5167 | | ''' </param> |
| | 5168 | | ''' <remarks> |
| | 5169 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5170 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5171 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5172 | | ''' </remarks> |
| | 5173 | | <Extension> |
| 4 | 5174 | | Public Sub LogEntry( |
| 4 | 5175 | | ByVal eventLog As EventLog, |
| 4 | 5176 | | ByVal message As String, |
| 4 | 5177 | | ByVal eventID As Integer, |
| 4 | 5178 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5179 | |
|
| 8 | 5180 | | LogEntry(eventLog, |
| 8 | 5181 | | message, |
| 8 | 5182 | | EventLogEntryType.Information, |
| 8 | 5183 | | eventID, |
| 8 | 5184 | | EntrySeverity) |
| | 5185 | |
|
| 8 | 5186 | | End Sub |
| | 5187 | |
|
| | 5188 | | ''' <summary> |
| | 5189 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5190 | | ''' </summary> |
| | 5191 | | ''' <param name="eventLog"> |
| | 5192 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5193 | | ''' with a valid log name and source. |
| | 5194 | | ''' </param> |
| | 5195 | | ''' <param name="message"> |
| | 5196 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5197 | | ''' |
| | 5198 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5199 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5200 | | ''' |
| | 5201 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5202 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5203 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5204 | | ''' </param> |
| | 5205 | | ''' <param name="category"> |
| | 5206 | | ''' A numeric category for the event. This is typically used in categorized views of the Event Log. |
| | 5207 | | ''' Use 0 if no category is needed. |
| | 5208 | | ''' </param> |
| | 5209 | | ''' <remarks> |
| | 5210 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5211 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5212 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5213 | | ''' </remarks> |
| | 5214 | | <Extension> |
| 4 | 5215 | | Public Sub LogEntry( |
| 4 | 5216 | | ByVal eventLog As EventLog, |
| 4 | 5217 | | ByVal message As String, |
| 4 | 5218 | | ByVal category As Short) |
| | 5219 | |
|
| 8 | 5220 | | LogEntry(eventLog, |
| 8 | 5221 | | message, |
| 8 | 5222 | | EventLogEntryType.Information, |
| 8 | 5223 | | category) |
| | 5224 | |
|
| 8 | 5225 | | End Sub |
| | 5226 | |
|
| | 5227 | | ''' <summary> |
| | 5228 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5229 | | ''' </summary> |
| | 5230 | | ''' <param name="eventLog"> |
| | 5231 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5232 | | ''' with a valid log name and source. |
| | 5233 | | ''' </param> |
| | 5234 | | ''' <param name="message"> |
| | 5235 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5236 | | ''' |
| | 5237 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5238 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5239 | | ''' |
| | 5240 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5241 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5242 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5243 | | ''' </param> |
| | 5244 | | ''' <param name="category"> |
| | 5245 | | ''' A numeric category for the event. This is typically used in categorized views of the Event Log. |
| | 5246 | | ''' Use 0 if no category is needed. |
| | 5247 | | ''' </param> |
| | 5248 | | ''' <param name="EntrySeverity"> |
| | 5249 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5250 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5251 | | ''' will be skipped and not written to the Event Log. |
| | 5252 | | ''' </param> |
| | 5253 | | ''' <remarks> |
| | 5254 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5255 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5256 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5257 | | ''' </remarks> |
| | 5258 | | <Extension> |
| 4 | 5259 | | Public Sub LogEntry( |
| 4 | 5260 | | ByVal eventLog As EventLog, |
| 4 | 5261 | | ByVal message As String, |
| 4 | 5262 | | ByVal category As Short, |
| 4 | 5263 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5264 | |
|
| 8 | 5265 | | LogEntry(eventLog, |
| 8 | 5266 | | message, |
| 8 | 5267 | | EventLogEntryType.Information, |
| 8 | 5268 | | category, |
| 8 | 5269 | | EntrySeverity) |
| | 5270 | |
|
| 8 | 5271 | | End Sub |
| | 5272 | |
|
| | 5273 | | ''' <summary> |
| | 5274 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5275 | | ''' </summary> |
| | 5276 | | ''' <param name="eventLog"> |
| | 5277 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5278 | | ''' with a valid log name and source. |
| | 5279 | | ''' </param> |
| | 5280 | | ''' <param name="message"> |
| | 5281 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5282 | | ''' |
| | 5283 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5284 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5285 | | ''' |
| | 5286 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5287 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5288 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5289 | | ''' </param> |
| | 5290 | | ''' <param name="eventType"> |
| | 5291 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5292 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5293 | | ''' </param> |
| | 5294 | | ''' <param name="eventID"> |
| | 5295 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5296 | | ''' or filtering related log entries. |
| | 5297 | | ''' </param> |
| | 5298 | | ''' <remarks> |
| | 5299 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5300 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5301 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5302 | | ''' </remarks> |
| | 5303 | | <Extension> |
| 8 | 5304 | | Public Sub LogEntry( |
| 8 | 5305 | | ByVal eventLog As EventLog, |
| 8 | 5306 | | ByVal message As String, |
| 8 | 5307 | | ByVal eventType As EventLogEntryType, |
| 8 | 5308 | | ByVal eventID As Integer) |
| | 5309 | |
|
| 16 | 5310 | | LogEntry(eventLog, |
| 16 | 5311 | | message, |
| 16 | 5312 | | eventType, |
| 16 | 5313 | | eventID, |
| 16 | 5314 | | 0) |
| | 5315 | |
|
| 16 | 5316 | | End Sub |
| | 5317 | |
|
| | 5318 | | ''' <summary> |
| | 5319 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5320 | | ''' </summary> |
| | 5321 | | ''' <param name="eventLog"> |
| | 5322 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5323 | | ''' with a valid log name and source. |
| | 5324 | | ''' </param> |
| | 5325 | | ''' <param name="message"> |
| | 5326 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5327 | | ''' |
| | 5328 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5329 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5330 | | ''' |
| | 5331 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5332 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5333 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5334 | | ''' </param> |
| | 5335 | | ''' <param name="eventType"> |
| | 5336 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5337 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5338 | | ''' </param> |
| | 5339 | | ''' <param name="eventID"> |
| | 5340 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5341 | | ''' or filtering related log entries. |
| | 5342 | | ''' </param> |
| | 5343 | | ''' <param name="EntrySeverity"> |
| | 5344 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5345 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5346 | | ''' will be skipped and not written to the Event Log. |
| | 5347 | | ''' </param> |
| | 5348 | | ''' <remarks> |
| | 5349 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5350 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5351 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5352 | | ''' </remarks> |
| | 5353 | | <Extension> |
| 32 | 5354 | | Public Sub LogEntry( |
| 32 | 5355 | | ByVal eventLog As EventLog, |
| 32 | 5356 | | ByVal message As String, |
| 32 | 5357 | | ByVal eventType As EventLogEntryType, |
| 32 | 5358 | | ByVal eventID As Integer, |
| 32 | 5359 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5360 | |
|
| 64 | 5361 | | LogEntry(eventLog, |
| 64 | 5362 | | message, |
| 64 | 5363 | | eventType, |
| 64 | 5364 | | eventID, |
| 64 | 5365 | | 0, |
| 64 | 5366 | | EntrySeverity) |
| | 5367 | |
|
| 64 | 5368 | | End Sub |
| | 5369 | |
|
| | 5370 | | ''' <summary> |
| | 5371 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5372 | | ''' </summary> |
| | 5373 | | ''' <param name="eventLog"> |
| | 5374 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5375 | | ''' with a valid log name and source. |
| | 5376 | | ''' </param> |
| | 5377 | | ''' <param name="message"> |
| | 5378 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5379 | | ''' |
| | 5380 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5381 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5382 | | ''' |
| | 5383 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5384 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5385 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5386 | | ''' </param> |
| | 5387 | | ''' <param name="eventType"> |
| | 5388 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5389 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5390 | | ''' </param> |
| | 5391 | | ''' <param name="category"> |
| | 5392 | | ''' A numeric category for the event. This is typically used in categorized views of the Event Log. |
| | 5393 | | ''' Use 0 if no category is needed. |
| | 5394 | | ''' </param> |
| | 5395 | | ''' <remarks> |
| | 5396 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5397 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5398 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5399 | | ''' </remarks> |
| | 5400 | | <Extension> |
| 4 | 5401 | | Public Sub LogEntry( |
| 4 | 5402 | | ByVal eventLog As EventLog, |
| 4 | 5403 | | ByVal message As String, |
| 4 | 5404 | | ByVal eventType As EventLogEntryType, |
| 4 | 5405 | | ByVal category As Short) |
| | 5406 | |
|
| 8 | 5407 | | LogEntry(eventLog, |
| 8 | 5408 | | message, |
| 8 | 5409 | | eventType, |
| 8 | 5410 | | 0, |
| 8 | 5411 | | category) |
| | 5412 | |
|
| 8 | 5413 | | End Sub |
| | 5414 | |
|
| | 5415 | | ''' <summary> |
| | 5416 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5417 | | ''' </summary> |
| | 5418 | | ''' <param name="eventLog"> |
| | 5419 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5420 | | ''' with a valid log name and source. |
| | 5421 | | ''' </param> |
| | 5422 | | ''' <param name="message"> |
| | 5423 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5424 | | ''' |
| | 5425 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5426 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5427 | | ''' |
| | 5428 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5429 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5430 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5431 | | ''' </param> |
| | 5432 | | ''' <param name="eventType"> |
| | 5433 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5434 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5435 | | ''' </param> |
| | 5436 | | ''' <param name="category"> |
| | 5437 | | ''' A numeric category for the event. This is typically used in categorized views of the Event Log. |
| | 5438 | | ''' Use 0 if no category is needed. |
| | 5439 | | ''' </param> |
| | 5440 | | ''' <param name="EntrySeverity"> |
| | 5441 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5442 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5443 | | ''' will be skipped and not written to the Event Log. |
| | 5444 | | ''' </param> |
| | 5445 | | ''' <remarks> |
| | 5446 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5447 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5448 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5449 | | ''' </remarks> |
| | 5450 | | <Extension> |
| 4 | 5451 | | Public Sub LogEntry( |
| 4 | 5452 | | ByVal eventLog As EventLog, |
| 4 | 5453 | | ByVal message As String, |
| 4 | 5454 | | ByVal eventType As EventLogEntryType, |
| 4 | 5455 | | ByVal category As Short, |
| 4 | 5456 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5457 | |
|
| 8 | 5458 | | LogEntry(eventLog, |
| 8 | 5459 | | message, |
| 8 | 5460 | | eventType, |
| 8 | 5461 | | 0, |
| 8 | 5462 | | category, |
| 8 | 5463 | | EntrySeverity) |
| | 5464 | |
|
| 8 | 5465 | | End Sub |
| | 5466 | |
|
| | 5467 | | ''' <summary> |
| | 5468 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5469 | | ''' </summary> |
| | 5470 | | ''' <param name="eventLog"> |
| | 5471 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5472 | | ''' with a valid log name and source. |
| | 5473 | | ''' </param> |
| | 5474 | | ''' <param name="message"> |
| | 5475 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5476 | | ''' |
| | 5477 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5478 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5479 | | ''' |
| | 5480 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5481 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5482 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5483 | | ''' </param> |
| | 5484 | | ''' <param name="eventType"> |
| | 5485 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5486 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5487 | | ''' </param> |
| | 5488 | | ''' <param name="eventID"> |
| | 5489 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5490 | | ''' or filtering related log entries. |
| | 5491 | | ''' </param> |
| | 5492 | | ''' <param name="category"> |
| | 5493 | | ''' A numeric category for the event. This is typically used in categorized views of the Event Log. |
| | 5494 | | ''' Use 0 if no category is needed. |
| | 5495 | | ''' </param> |
| | 5496 | | ''' <remarks> |
| | 5497 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5498 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5499 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5500 | | ''' </remarks> |
| | 5501 | | <Extension> |
| 4 | 5502 | | Public Sub LogEntry( |
| 4 | 5503 | | ByVal eventLog As EventLog, |
| 4 | 5504 | | ByVal message As String, |
| 4 | 5505 | | ByVal eventType As EventLogEntryType, |
| 4 | 5506 | | ByVal eventID As Integer, |
| 4 | 5507 | | ByVal category As Short) |
| | 5508 | |
|
| 8 | 5509 | | LogEntry(eventLog, |
| 8 | 5510 | | message, |
| 8 | 5511 | | eventType, |
| 8 | 5512 | | eventID, |
| 8 | 5513 | | category, |
| 8 | 5514 | | CType(Nothing, Byte())) |
| | 5515 | |
|
| 8 | 5516 | | End Sub |
| | 5517 | |
|
| | 5518 | | ''' <summary> |
| | 5519 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5520 | | ''' </summary> |
| | 5521 | | ''' <param name="eventLog"> |
| | 5522 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5523 | | ''' with a valid log name and source. |
| | 5524 | | ''' </param> |
| | 5525 | | ''' <param name="message"> |
| | 5526 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5527 | | ''' |
| | 5528 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5529 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5530 | | ''' |
| | 5531 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5532 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5533 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5534 | | ''' </param> |
| | 5535 | | ''' <param name="eventType"> |
| | 5536 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5537 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5538 | | ''' </param> |
| | 5539 | | ''' <param name="eventID"> |
| | 5540 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5541 | | ''' or filtering related log entries. |
| | 5542 | | ''' </param> |
| | 5543 | | ''' <param name="category"> |
| | 5544 | | ''' A numeric category for the event. This is typically used in categorized views of the Event Log. |
| | 5545 | | ''' Use 0 if no category is needed. |
| | 5546 | | ''' </param> |
| | 5547 | | ''' <param name="EntrySeverity"> |
| | 5548 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5549 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5550 | | ''' will be skipped and not written to the Event Log. |
| | 5551 | | ''' </param> |
| | 5552 | | ''' <remarks> |
| | 5553 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5554 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5555 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5556 | | ''' </remarks> |
| | 5557 | | <Extension> |
| 36 | 5558 | | Public Sub LogEntry( |
| 36 | 5559 | | ByVal eventLog As EventLog, |
| 36 | 5560 | | ByVal message As String, |
| 36 | 5561 | | ByVal eventType As EventLogEntryType, |
| 36 | 5562 | | ByVal eventID As Integer, |
| 36 | 5563 | | ByVal category As Short, |
| 36 | 5564 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5565 | |
|
| 72 | 5566 | | LogEntry(eventLog, |
| 72 | 5567 | | message, |
| 72 | 5568 | | eventType, |
| 72 | 5569 | | eventID, |
| 72 | 5570 | | category, |
| 72 | 5571 | | Nothing, |
| 72 | 5572 | | EntrySeverity) |
| | 5573 | |
|
| 72 | 5574 | | End Sub |
| | 5575 | |
|
| | 5576 | | ''' <summary> |
| | 5577 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5578 | | ''' </summary> |
| | 5579 | | ''' <param name="eventLog"> |
| | 5580 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5581 | | ''' with a valid log name and source. |
| | 5582 | | ''' </param> |
| | 5583 | | ''' <param name="message"> |
| | 5584 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5585 | | ''' |
| | 5586 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5587 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5588 | | ''' |
| | 5589 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5590 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5591 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5592 | | ''' </param> |
| | 5593 | | ''' <param name="rawData"> |
| | 5594 | | ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused. |
| | 5595 | | ''' </param> |
| | 5596 | | ''' <remarks> |
| | 5597 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5598 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5599 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5600 | | ''' </remarks> |
| | 5601 | | <Extension> |
| 12 | 5602 | | Public Sub LogEntry( |
| 12 | 5603 | | ByVal eventLog As EventLog, |
| 12 | 5604 | | ByVal message As String, |
| 12 | 5605 | | ByVal rawData As Byte()) |
| | 5606 | |
|
| 24 | 5607 | | LogEntry(eventLog, |
| 24 | 5608 | | message, |
| 24 | 5609 | | EventLogEntryType.Information, |
| 24 | 5610 | | rawData) |
| | 5611 | |
|
| 24 | 5612 | | End Sub |
| | 5613 | |
|
| | 5614 | | ''' <summary> |
| | 5615 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5616 | | ''' </summary> |
| | 5617 | | ''' <param name="eventLog"> |
| | 5618 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5619 | | ''' with a valid log name and source. |
| | 5620 | | ''' </param> |
| | 5621 | | ''' <param name="message"> |
| | 5622 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5623 | | ''' |
| | 5624 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5625 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5626 | | ''' |
| | 5627 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5628 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5629 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5630 | | ''' </param> |
| | 5631 | | ''' <param name="rawData"> |
| | 5632 | | ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused. |
| | 5633 | | ''' </param> |
| | 5634 | | ''' <param name="EntrySeverity"> |
| | 5635 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5636 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5637 | | ''' will be skipped and not written to the Event Log. |
| | 5638 | | ''' </param> |
| | 5639 | | ''' <remarks> |
| | 5640 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5641 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5642 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5643 | | ''' </remarks> |
| | 5644 | | <Extension> |
| 4 | 5645 | | Public Sub LogEntry( |
| 4 | 5646 | | ByVal eventLog As EventLog, |
| 4 | 5647 | | ByVal message As String, |
| 4 | 5648 | | ByVal rawData As Byte(), |
| 4 | 5649 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5650 | |
|
| 8 | 5651 | | LogEntry(eventLog, |
| 8 | 5652 | | message, |
| 8 | 5653 | | EventLogEntryType.Information, |
| 8 | 5654 | | rawData, |
| 8 | 5655 | | EntrySeverity) |
| | 5656 | |
|
| 8 | 5657 | | End Sub |
| | 5658 | |
|
| | 5659 | | ''' <summary> |
| | 5660 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5661 | | ''' </summary> |
| | 5662 | | ''' <param name="eventLog"> |
| | 5663 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5664 | | ''' with a valid log name and source. |
| | 5665 | | ''' </param> |
| | 5666 | | ''' <param name="message"> |
| | 5667 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5668 | | ''' |
| | 5669 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5670 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5671 | | ''' |
| | 5672 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5673 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5674 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5675 | | ''' </param> |
| | 5676 | | ''' <param name="eventType"> |
| | 5677 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5678 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5679 | | ''' </param> |
| | 5680 | | ''' <param name="rawData"> |
| | 5681 | | ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused. |
| | 5682 | | ''' </param> |
| | 5683 | | ''' <remarks> |
| | 5684 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5685 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5686 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5687 | | ''' </remarks> |
| | 5688 | | <Extension> |
| 12 | 5689 | | Public Sub LogEntry( |
| 12 | 5690 | | ByVal eventLog As EventLog, |
| 12 | 5691 | | ByVal message As String, |
| 12 | 5692 | | ByVal eventType As EventLogEntryType, |
| 12 | 5693 | | ByVal rawData As Byte()) |
| | 5694 | |
|
| 24 | 5695 | | LogEntry(eventLog, |
| 24 | 5696 | | message, |
| 24 | 5697 | | eventType, |
| 24 | 5698 | | 0, |
| 24 | 5699 | | rawData) |
| | 5700 | |
|
| 24 | 5701 | | End Sub |
| | 5702 | |
|
| | 5703 | | ''' <summary> |
| | 5704 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5705 | | ''' </summary> |
| | 5706 | | ''' <param name="eventLog"> |
| | 5707 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5708 | | ''' with a valid log name and source. |
| | 5709 | | ''' </param> |
| | 5710 | | ''' <param name="message"> |
| | 5711 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5712 | | ''' |
| | 5713 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5714 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5715 | | ''' |
| | 5716 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5717 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5718 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5719 | | ''' </param> |
| | 5720 | | ''' <param name="eventType"> |
| | 5721 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5722 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5723 | | ''' </param> |
| | 5724 | | ''' <param name="rawData"> |
| | 5725 | | ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused. |
| | 5726 | | ''' </param> |
| | 5727 | | ''' <param name="EntrySeverity"> |
| | 5728 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5729 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5730 | | ''' will be skipped and not written to the Event Log. |
| | 5731 | | ''' </param> |
| | 5732 | | ''' <remarks> |
| | 5733 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5734 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5735 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5736 | | ''' </remarks> |
| | 5737 | | <Extension> |
| 4 | 5738 | | Public Sub LogEntry( |
| 4 | 5739 | | ByVal eventLog As EventLog, |
| 4 | 5740 | | ByVal message As String, |
| 4 | 5741 | | ByVal eventType As EventLogEntryType, |
| 4 | 5742 | | ByVal rawData As Byte(), |
| 4 | 5743 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5744 | |
|
| 8 | 5745 | | LogEntry(eventLog, |
| 8 | 5746 | | message, |
| 8 | 5747 | | eventType, |
| 8 | 5748 | | 0, |
| 8 | 5749 | | rawData, |
| 8 | 5750 | | EntrySeverity) |
| | 5751 | |
|
| 8 | 5752 | | End Sub |
| | 5753 | |
|
| | 5754 | | ''' <summary> |
| | 5755 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5756 | | ''' </summary> |
| | 5757 | | ''' <param name="eventLog"> |
| | 5758 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5759 | | ''' with a valid log name and source. |
| | 5760 | | ''' </param> |
| | 5761 | | ''' <param name="message"> |
| | 5762 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5763 | | ''' |
| | 5764 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5765 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5766 | | ''' |
| | 5767 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5768 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5769 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5770 | | ''' </param> |
| | 5771 | | ''' <param name="eventType"> |
| | 5772 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5773 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5774 | | ''' </param> |
| | 5775 | | ''' <param name="eventID"> |
| | 5776 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5777 | | ''' or filtering related log entries. |
| | 5778 | | ''' </param> |
| | 5779 | | ''' <param name="rawData"> |
| | 5780 | | ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused. |
| | 5781 | | ''' </param> |
| | 5782 | | ''' <remarks> |
| | 5783 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5784 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5785 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5786 | | ''' </remarks> |
| | 5787 | | <Extension> |
| 12 | 5788 | | Public Sub LogEntry( |
| 12 | 5789 | | ByVal eventLog As EventLog, |
| 12 | 5790 | | ByVal message As String, |
| 12 | 5791 | | ByVal eventType As EventLogEntryType, |
| 12 | 5792 | | ByVal eventID As Integer, |
| 12 | 5793 | | ByVal rawData As Byte()) |
| | 5794 | |
|
| 24 | 5795 | | LogEntry(eventLog, |
| 24 | 5796 | | message, |
| 24 | 5797 | | eventType, |
| 24 | 5798 | | eventID, |
| 24 | 5799 | | 0, |
| 24 | 5800 | | rawData) |
| | 5801 | |
|
| 24 | 5802 | | End Sub |
| | 5803 | |
|
| | 5804 | | ''' <summary> |
| | 5805 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5806 | | ''' </summary> |
| | 5807 | | ''' <param name="eventLog"> |
| | 5808 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5809 | | ''' with a valid log name and source. |
| | 5810 | | ''' </param> |
| | 5811 | | ''' <param name="message"> |
| | 5812 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5813 | | ''' |
| | 5814 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5815 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5816 | | ''' |
| | 5817 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5818 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5819 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5820 | | ''' </param> |
| | 5821 | | ''' <param name="eventType"> |
| | 5822 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5823 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5824 | | ''' </param> |
| | 5825 | | ''' <param name="eventID"> |
| | 5826 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5827 | | ''' or filtering related log entries. |
| | 5828 | | ''' </param> |
| | 5829 | | ''' <param name="rawData"> |
| | 5830 | | ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused. |
| | 5831 | | ''' </param> |
| | 5832 | | ''' <param name="EntrySeverity"> |
| | 5833 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5834 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5835 | | ''' will be skipped and not written to the Event Log. |
| | 5836 | | ''' </param> |
| | 5837 | | ''' <remarks> |
| | 5838 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5839 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5840 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5841 | | ''' </remarks> |
| | 5842 | | <Extension> |
| 4 | 5843 | | Public Sub LogEntry( |
| 4 | 5844 | | ByVal eventLog As EventLog, |
| 4 | 5845 | | ByVal message As String, |
| 4 | 5846 | | ByVal eventType As EventLogEntryType, |
| 4 | 5847 | | ByVal eventID As Integer, |
| 4 | 5848 | | ByVal rawData As Byte(), |
| 4 | 5849 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5850 | |
|
| 8 | 5851 | | LogEntry(eventLog, |
| 8 | 5852 | | message, |
| 8 | 5853 | | eventType, |
| 8 | 5854 | | eventID, |
| 8 | 5855 | | 0, |
| 8 | 5856 | | rawData, |
| 8 | 5857 | | EntrySeverity) |
| | 5858 | |
|
| 8 | 5859 | | End Sub |
| | 5860 | |
|
| | 5861 | | ''' <summary> |
| | 5862 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5863 | | ''' </summary> |
| | 5864 | | ''' <param name="eventLog"> |
| | 5865 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5866 | | ''' with a valid log name and source. |
| | 5867 | | ''' </param> |
| | 5868 | | ''' <param name="message"> |
| | 5869 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5870 | | ''' |
| | 5871 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5872 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5873 | | ''' |
| | 5874 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5875 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5876 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5877 | | ''' </param> |
| | 5878 | | ''' <param name="eventType"> |
| | 5879 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5880 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5881 | | ''' </param> |
| | 5882 | | ''' <param name="eventID"> |
| | 5883 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5884 | | ''' or filtering related log entries. |
| | 5885 | | ''' </param> |
| | 5886 | | ''' <param name="category"> |
| | 5887 | | ''' A numeric category for the event. This is typically used in categorized views of the Event Log. |
| | 5888 | | ''' Use 0 if no category is needed. |
| | 5889 | | ''' </param> |
| | 5890 | | ''' <param name="rawData"> |
| | 5891 | | ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused. |
| | 5892 | | ''' </param> |
| | 5893 | | ''' <remarks> |
| | 5894 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5895 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5896 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5897 | | ''' </remarks> |
| | 5898 | | <Extension> |
| 20 | 5899 | | Public Sub LogEntry( |
| 20 | 5900 | | ByVal eventLog As EventLog, |
| 20 | 5901 | | ByVal message As String, |
| 20 | 5902 | | ByVal eventType As EventLogEntryType, |
| 20 | 5903 | | ByVal eventID As Integer, |
| 20 | 5904 | | ByVal category As Short, |
| 20 | 5905 | | ByVal rawData As Byte()) |
| | 5906 | |
|
| 40 | 5907 | | Initialize() |
| 40 | 5908 | | LogEntry(eventLog, |
| 40 | 5909 | | message, |
| 40 | 5910 | | eventType, |
| 40 | 5911 | | eventID, |
| 40 | 5912 | | category, |
| 40 | 5913 | | rawData, |
| 40 | 5914 | | LoggingSeverity) |
| | 5915 | |
|
| 40 | 5916 | | End Sub |
| | 5917 | |
|
| | 5918 | | ''' <summary> |
| | 5919 | | ''' Writes a log entry to the specified <see cref="EventLog"/> with the given parameters. |
| | 5920 | | ''' </summary> |
| | 5921 | | ''' <param name="eventLog"> |
| | 5922 | | ''' The <see cref="EventLog"/> instance to which the entry will be written. This must be properly initialized |
| | 5923 | | ''' with a valid log name and source. |
| | 5924 | | ''' </param> |
| | 5925 | | ''' <param name="message"> |
| | 5926 | | ''' The message to log. If <c>null</c> or empty, a default message is used. |
| | 5927 | | ''' |
| | 5928 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>false</c> (default), messages longer than 32,766 characters are t |
| | 5929 | | ''' and suffixed with the <see cref="TruncationMarker"/> (e.g., <c>"... [TRUNCATED]"</c>). |
| | 5930 | | ''' |
| | 5931 | | ''' If <see cref="AllowMultiEntryMessages"/> is <c>true</c>, long messages are split into multiple event entries, |
| | 5932 | | ''' each prefixed with part information (e.g., <c>[Part 1/3]</c>) and intermediate entries are suffixed with |
| | 5933 | | ''' the <see cref="ContinuationMarker"/> (e.g., <c>" ..."</c>) to indicate continuation. |
| | 5934 | | ''' </param> |
| | 5935 | | ''' <param name="eventType"> |
| | 5936 | | ''' The type of event. Valid values are <see cref="EventLogEntryType.Error"/>, <see cref="EventLogEntryType.Warning" |
| | 5937 | | ''' <see cref="EventLogEntryType.Information"/>. If invalid, <c>Information</c> is used. |
| | 5938 | | ''' </param> |
| | 5939 | | ''' <param name="eventID"> |
| | 5940 | | ''' A numeric identifier for the event. This value is application-defined and can be used for categorizing |
| | 5941 | | ''' or filtering related log entries. |
| | 5942 | | ''' </param> |
| | 5943 | | ''' <param name="category"> |
| | 5944 | | ''' A numeric category for the event. This is typically used in categorized views of the Event Log. |
| | 5945 | | ''' Use 0 if no category is needed. |
| | 5946 | | ''' </param> |
| | 5947 | | ''' <param name="rawData"> |
| | 5948 | | ''' Optional binary data to associate with the log entry. This can be <c>null</c> if unused. |
| | 5949 | | ''' </param> |
| | 5950 | | ''' <param name="EntrySeverity"> |
| | 5951 | | ''' Indicates the importance or severity of this log entry relative to the configured logging threshold |
| | 5952 | | ''' (<see cref="CurrentLoggingLevel"/>). If the severity is lower than the current logging level, the entry |
| | 5953 | | ''' will be skipped and not written to the Event Log. |
| | 5954 | | ''' </param> |
| | 5955 | | ''' <remarks> |
| | 5956 | | ''' This method uses configured or default values for formatting and fallbacks. The message is normalized |
| | 5957 | | ''' and validated prior to writing. If you are using a test environment, an alternate writer can be configured |
| | 5958 | | ''' to intercept and test log output without writing to the system Event Log. |
| | 5959 | | ''' </remarks> |
| | 5960 | | <Extension> |
| 60 | 5961 | | Public Sub LogEntry( |
| 60 | 5962 | | ByVal eventLog As EventLog, |
| 60 | 5963 | | ByVal message As String, |
| 60 | 5964 | | ByVal eventType As EventLogEntryType, |
| 60 | 5965 | | ByVal eventID As Integer, |
| 60 | 5966 | | ByVal category As Short, |
| 60 | 5967 | | ByVal rawData As Byte(), |
| 60 | 5968 | | ByVal EntrySeverity As LoggingSeverity) |
| | 5969 | |
|
| 120 | 5970 | | Initialize() ' By the time we get here, this should already be done, but just in case. |
| | 5971 | |
|
| 124 | 5972 | | If EntrySeverity < CurrentLoggingLevel Then Exit Sub |
| | 5973 | |
|
| 112 | 5974 | | Dim defaultSource As String = Source(eventLog.Source) |
| 112 | 5975 | | Dim finalEventType As EventLogEntryType = NormalizeEventType(eventType) |
| | 5976 | |
|
| 112 | 5977 | | If AllowMultiEntryMessages AndAlso message.Length > 32766 Then |
| 16 | 5978 | | For Each chunk As String In SplitMessageIntoPages(defaultSource, message) |
| 32 | 5979 | | _writer.WriteEntry(eventLog, |
| 32 | 5980 | | chunk, |
| 32 | 5981 | | finalEventType, |
| 32 | 5982 | | eventID, |
| 32 | 5983 | | category, |
| 32 | 5984 | | rawData) |
| 16 | 5985 | | Next |
| 48 | 5986 | | Else |
| 96 | 5987 | | _writer.WriteEntry(eventLog, |
| 96 | 5988 | | NormalizeMessage(eventLog.Source, message), |
| 96 | 5989 | | NormalizeEventType(eventType), |
| 96 | 5990 | | eventID, |
| 96 | 5991 | | category, |
| 96 | 5992 | | rawData) |
| 56 | 5993 | | End If |
| | 5994 | |
|
| 120 | 5995 | | End Sub |
| | 5996 | |
|
| | 5997 | | #End Region |
| | 5998 | |
|
| | 5999 | | #Region " Support Functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
| | 6000 | |
|
| | 6001 | | ''' <summary> |
| | 6002 | | ''' Returns a default event source name. If none is provided, this attempts to determine the calling |
| | 6003 | | ''' method's fully qualified name as the source. |
| | 6004 | | ''' </summary> |
| | 6005 | | ''' <param name="eventSourceName">Optional. A specific source name to use. If null or empty, the calling method will |
| | 6006 | | ''' <returns>A valid event source name derived from the input or calling method.</returns> |
| 480 | 6007 | | Public Function Source( |
| 480 | 6008 | | Optional ByVal eventSourceName As String = Nothing) As String |
| | 6009 | |
|
| | 6010 | | ' Final fallback if nothing else is available |
| 960 | 6011 | | Dim strReturn As String = "SmartEventLogger" |
| | 6012 | |
|
| 960 | 6013 | | If String.IsNullOrEmpty(eventSourceName) Then |
| 272 | 6014 | | If Not String.IsNullOrEmpty(SourceName) Then |
| 8 | 6015 | | strReturn = SourceName |
| 132 | 6016 | | Else |
| | 6017 | | ' Try to get the calling assembly (e.g., the one calling your library) |
| 264 | 6018 | | Dim thisAssembly As Assembly = Assembly.GetExecutingAssembly() |
| | 6019 | |
|
| 264 | 6020 | | Dim stackTrace As New StackTrace() |
| 264 | 6021 | | For i As Integer = 1 To stackTrace.FrameCount - 1 |
| 2056 | 6022 | | Dim frame As StackFrame = stackTrace.GetFrame(i) |
| 2056 | 6023 | | Dim method As MethodBase = frame.GetMethod() |
| 2056 | 6024 | | Dim type As Type = method.DeclaringType |
| 2056 | 6025 | | If type.Assembly IsNot thisAssembly Then |
| 264 | 6026 | | strReturn = $"{type.FullName}.{method.Name}" |
| 264 | 6027 | | Exit For |
| 896 | 6028 | | End If |
| 1792 | 6029 | | Next |
| 140 | 6030 | | End If |
| 344 | 6031 | | Else |
| 688 | 6032 | | strReturn = eventSourceName.Trim() |
| 480 | 6033 | | End If |
| | 6034 | |
|
| | 6035 | | ' Ensure the source name does not exceed the maximum length allowed by the Windows Event Log system |
| 960 | 6036 | | Return MaxSource(strReturn) |
| | 6037 | |
|
| 960 | 6038 | | End Function |
| | 6039 | |
|
| | 6040 | | ''' <summary> |
| | 6041 | | ''' Attempts to determine a default source name for the given event log by inspecting the registry. |
| | 6042 | | ''' </summary> |
| | 6043 | | ''' <param name="log">The name of the event log (e.g., "Application", "System").</param> |
| | 6044 | | ''' <returns>The name of a registered event source, or an empty string if none are found.</returns> |
| 4 | 6045 | | Public Function DefaultSource( |
| 4 | 6046 | | ByVal log As String) As String |
| | 6047 | |
|
| 8 | 6048 | | Initialize() |
| | 6049 | |
|
| 8 | 6050 | | Return DefaultSource(log, MachineName) |
| | 6051 | |
|
| 8 | 6052 | | End Function |
| | 6053 | |
|
| | 6054 | | ''' <summary> |
| | 6055 | | ''' Attempts to determine a default source name for the given event log by inspecting the registry. |
| | 6056 | | ''' </summary> |
| | 6057 | | ''' <param name="logName">The name of the event log (e.g., "Application", "System").</param> |
| | 6058 | | ''' <param name="machineName">The target machine name, or "." for the local machine.</param> |
| | 6059 | | ''' <returns>The name of a registered event source, or an empty string if none are found.</returns> |
| 4 | 6060 | | Public Function DefaultSource( |
| 4 | 6061 | | ByVal logName As String, |
| 4 | 6062 | | ByVal machineName As String) As String |
| | 6063 | |
|
| 8 | 6064 | | Return _registryReader.GetDefaultEventLogSource(logName, machineName) |
| | 6065 | |
|
| 8 | 6066 | | End Function |
| | 6067 | |
|
| | 6068 | | ''' <summary> |
| | 6069 | | ''' Truncates the source name to meet the maximum length allowed by the Windows Event Log system. |
| | 6070 | | ''' </summary> |
| | 6071 | | ''' <param name="sourceName">The original source name.</param> |
| | 6072 | | ''' <returns>A source name no longer than 211 characters.</returns> |
| | 6073 | | ''' <remarks> |
| | 6074 | | ''' If the input is null or empty, the method will derive a source name using the calling method. |
| | 6075 | | ''' </remarks> |
| 552 | 6076 | | Public Function MaxSource( |
| 552 | 6077 | | ByVal sourceName As String) As String |
| | 6078 | |
|
| 1104 | 6079 | | If String.IsNullOrEmpty(sourceName) Then |
| 16 | 6080 | | sourceName = Source() |
| 560 | 6081 | | End If |
| | 6082 | |
|
| 1104 | 6083 | | Return sourceName.Substring(0, If(sourceName.Length > 211, 211, sourceName.Length)) |
| | 6084 | |
|
| 1104 | 6085 | | End Function |
| | 6086 | |
|
| | 6087 | | ''' <summary> |
| | 6088 | | ''' Checks whether a specific source is registered to a specific event log on the specified machine. |
| | 6089 | | ''' </summary> |
| | 6090 | | ''' <param name="sourceName">The name of the event source.</param> |
| | 6091 | | ''' <param name="logName">The name of the event log (e.g., "Application").</param> |
| | 6092 | | ''' <param name="machineName">The target machine name, or "." for the local machine.</param> |
| | 6093 | | ''' <returns><c>True</c> if the source is registered; otherwise, <c>False</c>.</returns> |
| 4 | 6094 | | Public Function IsSourceRegisteredToLog( |
| 4 | 6095 | | ByVal sourceName As String, |
| 4 | 6096 | | ByVal logName As String, |
| 4 | 6097 | | ByVal machineName As String) As Boolean |
| | 6098 | |
|
| 8 | 6099 | | Dim registryPath As String = $"SYSTEM\CurrentControlSet\Services\EventLog\{logName}\{sourceName}" |
| | 6100 | |
|
| 8 | 6101 | | Return _registryReader.SubKeyExists(RegistryHive.LocalMachine, machineName, registryPath) |
| | 6102 | |
|
| 8 | 6103 | | End Function |
| | 6104 | |
|
| | 6105 | | ''' <summary> |
| | 6106 | | ''' Checks if the current user has read access to the registry key for a specific event log source. |
| | 6107 | | ''' </summary> |
| | 6108 | | ''' <param name="sourceName">The name of the event source.</param> |
| | 6109 | | ''' <param name="logName">The name of the event log.</param> |
| | 6110 | | ''' <param name="machineName">The machine to check, or "." for local machine.</param> |
| | 6111 | | ''' <returns><c>True</c> if the registry key can be read; otherwise, <c>False</c>.</returns> |
| 4 | 6112 | | Public Function CanReadRegistryForLogAndSource( |
| 4 | 6113 | | ByVal sourceName As String, |
| 4 | 6114 | | ByVal logName As String, |
| 4 | 6115 | | ByVal machineName As String) As Boolean |
| | 6116 | |
|
| 8 | 6117 | | Dim registryPath As String = $"SYSTEM\CurrentControlSet\Services\EventLog\{logName}\{sourceName}" |
| | 6118 | |
|
| 8 | 6119 | | Return _registryReader.HasRegistryAccess(RegistryHive.LocalMachine, machineName, registryPath, False) |
| | 6120 | |
|
| 8 | 6121 | | End Function |
| | 6122 | |
|
| | 6123 | | ''' <summary> |
| | 6124 | | ''' Determines if the current user has access (read or write) to the registry key for a given event log. |
| | 6125 | | ''' </summary> |
| | 6126 | | ''' <param name="logName">The name of the event log.</param> |
| | 6127 | | ''' <param name="machineName">The target machine name, or "." for local machine.</param> |
| | 6128 | | ''' <param name="writeAccess">Optional. <c>True</c> to check for write access; otherwise, <c>False</c> for read-only |
| | 6129 | | ''' <returns><c>True</c> if access is permitted; otherwise, <c>False</c>.</returns> |
| 4 | 6130 | | Public Function CanReadRegistryForLog( |
| 4 | 6131 | | ByVal logName As String, |
| 4 | 6132 | | ByVal machineName As String, |
| 4 | 6133 | | Optional ByVal writeAccess As Boolean = False) As Boolean |
| | 6134 | |
|
| 8 | 6135 | | Dim registryPath As String = $"SYSTEM\CurrentControlSet\Services\EventLog\{logName}" |
| | 6136 | |
|
| 8 | 6137 | | Return _registryReader.HasRegistryAccess(RegistryHive.LocalMachine, machineName, registryPath, writeAccess) |
| | 6138 | |
|
| 8 | 6139 | | End Function |
| | 6140 | |
|
| | 6141 | | ''' <summary> |
| | 6142 | | ''' Normalizes the message. |
| | 6143 | | ''' </summary> |
| | 6144 | | ''' <param name="sourceName">Name of the source.</param> |
| | 6145 | | ''' <param name="message">The message.</param> |
| | 6146 | | ''' <returns></returns> |
| 212 | 6147 | | Private Function NormalizeMessage( |
| 212 | 6148 | | ByVal sourceName As String, |
| 212 | 6149 | | ByVal message As String) As String |
| | 6150 | |
|
| 424 | 6151 | | Dim defaultSource As String = Source(sourceName) |
| 424 | 6152 | | Dim finalMessage As String = If(String.IsNullOrEmpty(message), "No message provided.", message.Trim()) |
| 792 | 6153 | | If Not finalMessage.EndsWith("."c, StringComparison.CurrentCultureIgnoreCase) Then finalMessage &= "." |
| 840 | 6154 | | If _IncludeSourceInMessage AndAlso Not finalMessage.StartsWith("["c, StringComparison.CurrentCultureIgnoreCase) |
| | 6155 | |
|
| | 6156 | | Const maxLength As Integer = 32766 |
| | 6157 | | Const _truncationMarker As String = "... [TRUNCATED]" |
| 424 | 6158 | | Dim marker As String = If(String.IsNullOrEmpty(TruncationMarker), _truncationMarker, TruncationMarker) |
| | 6159 | |
|
| 424 | 6160 | | If finalMessage.Length > maxLength Then |
| | 6161 | | ' Leave room for the truncation marker |
| 104 | 6162 | | Dim maxWithoutMarker As Integer = maxLength - marker.Length |
| 104 | 6163 | | finalMessage = $"{finalMessage.Substring(0, maxWithoutMarker)}{marker}" |
| 264 | 6164 | | End If |
| | 6165 | |
|
| 424 | 6166 | | Return finalMessage |
| | 6167 | |
|
| 424 | 6168 | | End Function |
| | 6169 | |
|
| | 6170 | | ''' <summary> |
| | 6171 | | ''' Splits the message into pages. |
| | 6172 | | ''' </summary> |
| | 6173 | | ''' <param name="sourceName">Name of the source.</param> |
| | 6174 | | ''' <param name="message">The message.</param> |
| | 6175 | | ''' <returns></returns> |
| 12 | 6176 | | Private Function SplitMessageIntoPages( |
| 12 | 6177 | | ByVal sourceName As String, |
| 12 | 6178 | | ByVal message As String) As IEnumerable(Of String) |
| | 6179 | |
|
| | 6180 | | Const maxLength As Integer = 32766 |
| 24 | 6181 | | Dim defaultSource As String = Source(sourceName) |
| 24 | 6182 | | Dim baseMessage As String = message.Trim() |
| 48 | 6183 | | If Not baseMessage.EndsWith("."c, StringComparison.CurrentCultureIgnoreCase) Then baseMessage &= "." |
| | 6184 | |
|
| 24 | 6185 | | Dim cm As String = ContinuationMarker |
| | 6186 | |
|
| 32 | 6187 | | If String.IsNullOrEmpty(cm) Then cm = " ..." |
| | 6188 | |
|
| | 6189 | | ' Initial prefix length calculation |
| | 6190 | | ' Format: "[Source] [Part 999/999] " |
| 24 | 6191 | | Dim maxPartsEstimate As Integer = CInt(Math.Ceiling(baseMessage.Length / (maxLength - 50))) |
| 24 | 6192 | | Dim digitCount As Integer = maxPartsEstimate.ToString(CultureInfo.InvariantCulture).Length + 1 ' pad by 1 digit |
| | 6193 | |
|
| | 6194 | | ' Build conservative prefix sample with max digit placeholders |
| 24 | 6195 | | Dim maxPartsPlaceholder As New String("9"c, digitCount) |
| | 6196 | | Dim prefixSample As String |
| 24 | 6197 | | If _IncludeSourceInMessage Then |
| 16 | 6198 | | prefixSample = $"[{defaultSource}] [Part {maxPartsPlaceholder}/{maxPartsPlaceholder}] " |
| 4 | 6199 | | Else |
| 8 | 6200 | | prefixSample = $"[Part {maxPartsPlaceholder}/{maxPartsPlaceholder}] " |
| 20 | 6201 | | End If |
| | 6202 | | ' Calculate the chunk size by subtracting the prefix length and the space for " ..." at the end of a chunk |
| 24 | 6203 | | Dim chunkSize As Integer = maxLength - prefixSample.Length - cm.Length |
| | 6204 | |
|
| | 6205 | | ' Now split message |
| 24 | 6206 | | Dim parts As New List(Of String) |
| 24 | 6207 | | Dim index As Integer = 0 |
| 72 | 6208 | | While index < baseMessage.Length |
| 48 | 6209 | | Dim len As Integer = Math.Min(chunkSize, baseMessage.Length - index) |
| 48 | 6210 | | parts.Add(baseMessage.Substring(index, len)) |
| 48 | 6211 | | index += len |
| 24 | 6212 | | End While |
| | 6213 | |
|
| | 6214 | | ' Now wrap each chunk with prefix |
| 24 | 6215 | | Dim total As Integer = parts.Count |
| 24 | 6216 | | Dim result As New List(Of String) |
| 24 | 6217 | | For i As Integer = 0 To total - 2 |
| 24 | 6218 | | If IncludeSourceInMessage Then |
| 16 | 6219 | | result.Add($"[{defaultSource}] [Part {i + 1}/{total}] {parts(i)}{cm}") |
| 4 | 6220 | | Else |
| 8 | 6221 | | result.Add($"[Part {i + 1}/{total}] {parts(i)}{cm}") |
| 20 | 6222 | | End If |
| 24 | 6223 | | Next |
| 24 | 6224 | | If IncludeSourceInMessage Then |
| 16 | 6225 | | result.Add($"[{defaultSource}] [Part {total}/{total}] {parts(total - 1)}") |
| 4 | 6226 | | Else |
| 8 | 6227 | | result.Add($"[Part {total}/{total}] {parts(total - 1)}") |
| 20 | 6228 | | End If |
| | 6229 | |
|
| 24 | 6230 | | Return result |
| | 6231 | |
|
| 24 | 6232 | | End Function |
| | 6233 | |
|
| | 6234 | | ''' <summary> |
| | 6235 | | ''' Normalizes the type of the event. |
| | 6236 | | ''' </summary> |
| | 6237 | | ''' <param name="eventType">Type of the event.</param> |
| | 6238 | | ''' <returns></returns> |
| 272 | 6239 | | Private Function NormalizeEventType( |
| 272 | 6240 | | ByVal eventType As EventLogEntryType) As EventLogEntryType |
| | 6241 | |
|
| 544 | 6242 | | Select Case eventType |
| 228 | 6243 | | Case EventLogEntryType.Error, EventLogEntryType.Warning, EventLogEntryType.Information |
| 456 | 6244 | | Return eventType |
| 44 | 6245 | | Case Else |
| 88 | 6246 | | Return EventLogEntryType.Information |
| | 6247 | | End Select |
| | 6248 | |
|
| 544 | 6249 | | End Function |
| | 6250 | |
|
| | 6251 | | ''' <summary> |
| | 6252 | | ''' Normalizes the name of the machine. |
| | 6253 | | ''' </summary> |
| | 6254 | | ''' <param name="_machineName">Name of the machine.</param> |
| | 6255 | | ''' <returns></returns> |
| 232 | 6256 | | Private Function NormalizeMachineName( |
| 232 | 6257 | | ByVal _machineName As String) As String |
| | 6258 | |
|
| 464 | 6259 | | Return If(String.IsNullOrEmpty(_machineName), If(String.IsNullOrEmpty(MachineName), ".", MachineName), _machineN |
| | 6260 | |
|
| 240 | 6261 | | End Function |
| | 6262 | |
|
| | 6263 | | #If NETFRAMEWORK Then |
| | 6264 | | ''' <summary> |
| | 6265 | | ''' Reads an application setting by key, returning <paramref name="defaultValue"/> |
| | 6266 | | ''' when no setting is found or an error occurs. |
| | 6267 | | ''' </summary> |
| | 6268 | | ''' <param name="key">The configuration key to retrieve.</param> |
| | 6269 | | ''' <param name="defaultValue">The fallback value if the key is missing or empty.</param> |
| | 6270 | | ''' <remarks> |
| | 6271 | | ''' <para> |
| | 6272 | | ''' <b>.NET Framework:</b> Reads from <c>App.config</c> / <c>Web.config</c> using |
| | 6273 | | ''' <see cref="ConfigurationManager.AppSettings"/>. |
| | 6274 | | ''' </para> |
| | 6275 | | ''' <para> |
| | 6276 | | ''' If the key is not present or the value is empty, <paramref name="defaultValue"/> is returned. |
| | 6277 | | ''' </para> |
| | 6278 | | ''' </remarks> |
| | 6279 | | ''' <returns>The resolved configuration value or the provided default.</returns> |
| | 6280 | | Friend Function GetAppSetting( |
| | 6281 | | ByVal key As String, |
| | 6282 | | ByVal defaultValue As String) As String |
| | 6283 | |
|
| | 6284 | | Dim value As String = String.Empty |
| | 6285 | | Try |
| | 6286 | | ' .NET Framework: App.config / Web.config |
| | 6287 | | value = ConfigurationManager.AppSettings(key) |
| | 6288 | | Catch ex As Exception |
| | 6289 | | value = defaultValue |
| | 6290 | | End Try |
| | 6291 | |
|
| | 6292 | | If String.IsNullOrEmpty(value) Then |
| | 6293 | | value = defaultValue |
| | 6294 | | End If |
| | 6295 | |
|
| | 6296 | | Return value |
| | 6297 | |
|
| | 6298 | | End Function |
| | 6299 | | #Else |
| | 6300 | | ''' <summary> |
| | 6301 | | ''' Reads an application setting by key, returning <paramref name="defaultValue"/> |
| | 6302 | | ''' when no setting is found or an error occurs. |
| | 6303 | | ''' </summary> |
| | 6304 | | ''' <param name="key">The configuration key to retrieve.</param> |
| | 6305 | | ''' <param name="defaultValue">The fallback value if the key is missing or empty.</param> |
| | 6306 | | ''' <remarks> |
| | 6307 | | ''' <para> |
| | 6308 | | ''' <b>.NET Core / .NET 5+:</b> If <c>appsettings.json</c> exists in <c>AppContext.BaseDirectory</c>, |
| | 6309 | | ''' reads exclusively from it via <see cref="ConfigurationBuilder"/>. |
| | 6310 | | ''' If the file does not exist, falls back to <c>App.config</c> / <c>Web.config</c> using |
| | 6311 | | ''' <see cref="System.Configuration.ConfigurationManager.AppSettings"/>. |
| | 6312 | | ''' </para> |
| | 6313 | | ''' <para> |
| | 6314 | | ''' If the key is not present or the value is empty, <paramref name="defaultValue"/> is returned. |
| | 6315 | | ''' </para> |
| | 6316 | | ''' </remarks> |
| | 6317 | | ''' <returns>The resolved configuration value or the provided default.</returns> |
| 3304 | 6318 | | Friend Function GetAppSetting( |
| 3304 | 6319 | | ByVal key As String, |
| 3304 | 6320 | | ByVal defaultValue As String) As String |
| | 6321 | |
|
| 6608 | 6322 | | Dim value As String = String.Empty |
| | 6323 | | ' .NET Core / .NET 5+ |
| | 6324 | | ' If appsettings.json exists, ONLY use it (ignore App.config/Web.config completely). |
| | 6325 | | ' If appsettings.json does not exist, fall back to App.config/Web.config. |
| | 6326 | | ' Missing or empty keys in either case fall back to defaultValue. |
| 6608 | 6327 | | Dim jsonPath As String = Path.Combine(AppContext.BaseDirectory, JsonSettingsFile) |
| 6608 | 6328 | | If FileSystem.FileExists(jsonPath) Then |
| 3296 | 6329 | | Try |
| 6592 | 6330 | | Dim builder As New ConfigurationBuilder() |
| 6592 | 6331 | | builder.SetBasePath(AppContext.BaseDirectory) |
| 6592 | 6332 | | builder.AddJsonFile(JsonSettingsFile, optional:=True, reloadOnChange:=True) |
| 6592 | 6333 | | Dim cr As IConfigurationRoot = builder.Build() |
| | 6334 | |
|
| 6584 | 6335 | | value = cr(key) |
| 4 | 6336 | | Catch ex As Exception |
| 8 | 6337 | | value = defaultValue |
| 3296 | 6338 | | End Try |
| 8 | 6339 | | Else |
| 8 | 6340 | | Try |
| | 6341 | | ' App.config / Web.config |
| 16 | 6342 | | value = Config.GetAppSetting(key) |
| 4 | 6343 | | Catch ex As Exception |
| 8 | 6344 | | value = defaultValue |
| 8 | 6345 | | End Try |
| 3304 | 6346 | | End If |
| | 6347 | |
|
| 6608 | 6348 | | If String.IsNullOrEmpty(value) Then |
| 4048 | 6349 | | value = defaultValue |
| 5328 | 6350 | | End If |
| | 6351 | |
|
| 6608 | 6352 | | Return value |
| | 6353 | |
|
| 6608 | 6354 | | End Function |
| | 6355 | | #End If |
| | 6356 | |
|
| | 6357 | | ''' <summary> |
| | 6358 | | ''' Gets the application setting. |
| | 6359 | | ''' </summary> |
| | 6360 | | ''' <param name="key">The key.</param> |
| | 6361 | | ''' <param name="defaultValue">The default value.</param> |
| | 6362 | | ''' <returns></returns> |
| 504 | 6363 | | Private Function GetAppSetting( |
| 504 | 6364 | | ByVal key As String, |
| 504 | 6365 | | ByVal defaultValue As Integer) As Integer |
| | 6366 | |
|
| 1008 | 6367 | | Dim raw As String = GetAppSetting(key, defaultValue.ToString(CultureInfo.InvariantCulture)) |
| | 6368 | |
|
| | 6369 | | Dim result As Integer |
| 1008 | 6370 | | Return If(Integer.TryParse(raw, result), result, defaultValue) |
| | 6371 | |
|
| 756 | 6372 | | End Function |
| | 6373 | |
|
| | 6374 | | ''' <summary> |
| | 6375 | | ''' Gets the application setting. |
| | 6376 | | ''' </summary> |
| | 6377 | | ''' <param name="key">The key.</param> |
| | 6378 | | ''' <param name="defaultValue">if set to <c>true</c> default value.</param> |
| | 6379 | | ''' <returns></returns> |
| 756 | 6380 | | Private Function GetAppSetting( |
| 756 | 6381 | | ByVal key As String, |
| 756 | 6382 | | ByVal defaultValue As Boolean) As Boolean |
| | 6383 | |
|
| 1512 | 6384 | | Dim raw As String = GetAppSetting(key, defaultValue.ToString()) |
| | 6385 | |
|
| | 6386 | | Dim result As Boolean |
| 1512 | 6387 | | Return If(Boolean.TryParse(raw, result), result, defaultValue) |
| | 6388 | |
|
| 1260 | 6389 | | End Function |
| | 6390 | |
|
| | 6391 | | ''' <summary> |
| | 6392 | | ''' Gets the application setting. |
| | 6393 | | ''' </summary> |
| | 6394 | | ''' <typeparam name="TEnum">The type of the enum.</typeparam> |
| | 6395 | | ''' <param name="key">The key.</param> |
| | 6396 | | ''' <param name="defaultValue">The default value.</param> |
| | 6397 | | ''' <returns></returns> |
| | 6398 | | ''' <exception cref="ArgumentException">{NameOf(TEnum)} must be an Enum type.</exception> |
| 772 | 6399 | | Friend Function GetAppSetting(Of TEnum As Structure)( |
| 772 | 6400 | | ByVal key As String, |
| 772 | 6401 | | ByVal defaultValue As TEnum) As TEnum |
| | 6402 | |
|
| | 6403 | | ' Make sure TEnum is actually an Enum |
| 1544 | 6404 | | If Not GetType(TEnum).IsEnum Then |
| 8 | 6405 | | Throw New ArgumentException($"{NameOf(TEnum)} must be an Enum type.") |
| 768 | 6406 | | End If |
| | 6407 | |
|
| 1536 | 6408 | | Dim rawValue As String = GetAppSetting(key, CType(Nothing, String)) |
| 1536 | 6409 | | If String.IsNullOrEmpty(rawValue) Then |
| 1512 | 6410 | | Return defaultValue |
| 12 | 6411 | | End If |
| | 6412 | |
|
| 12 | 6413 | | Try |
| | 6414 | | ' Use Enum.Parse for .NET 3.5 compatibility |
| | 6415 | | #If NETFRAMEWORK Then |
| | 6416 | | Dim parsedObj As Object = [Enum].Parse(GetType(TEnum), rawValue, True) |
| | 6417 | | #Else |
| 24 | 6418 | | Dim parsedObj As Object = [Enum].Parse(Of TEnum)(rawValue, True) |
| | 6419 | | #End If |
| 8 | 6420 | | Return CType(parsedObj, TEnum) |
| 4 | 6421 | | Catch ex As ArgumentException |
| | 6422 | | ' Value not valid for the enum |
| 8 | 6423 | | Return defaultValue |
| 4 | 6424 | | Catch ex As OverflowException |
| | 6425 | | ' In case of underlying type overflow |
| 8 | 6426 | | Return defaultValue |
| | 6427 | | End Try |
| | 6428 | |
|
| 1536 | 6429 | | End Function |
| | 6430 | |
|
| | 6431 | | #End Region |
| | 6432 | |
|
| | 6433 | | #Region " GetLog routines ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
| | 6434 | |
|
| | 6435 | | ''' <summary> |
| | 6436 | | ''' Gets the entry log class to use for writing to the event log. |
| | 6437 | | ''' </summary> |
| | 6438 | | ''' <returns></returns> |
| 4 | 6439 | | Public Function GetLog() As EventLog |
| | 6440 | |
|
| 8 | 6441 | | Initialize() |
| | 6442 | |
|
| 8 | 6443 | | Return GetLog( |
| 8 | 6444 | | SourceName) |
| | 6445 | |
|
| 8 | 6446 | | End Function |
| | 6447 | |
|
| | 6448 | | ''' <summary> |
| | 6449 | | ''' Gets the entry log class to use for writing to the event log. |
| | 6450 | | ''' </summary> |
| | 6451 | | ''' <param name="sourceName"> |
| | 6452 | | ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically |
| | 6453 | | ''' generated using the calling method's namespace, class, and method name. |
| | 6454 | | ''' If the source exceeds 254 characters, it is automatically truncated. |
| | 6455 | | ''' </param> |
| | 6456 | | ''' <returns></returns> |
| 4 | 6457 | | Public Function GetLog( |
| 4 | 6458 | | ByVal sourceName As String) As EventLog |
| | 6459 | |
|
| 8 | 6460 | | Initialize() |
| | 6461 | |
|
| 8 | 6462 | | Return GetLog( |
| 8 | 6463 | | LogName, |
| 8 | 6464 | | sourceName) |
| | 6465 | |
|
| 8 | 6466 | | End Function |
| | 6467 | |
|
| | 6468 | | ''' <summary> |
| | 6469 | | ''' Gets the entry log class to use for writing to the event log. |
| | 6470 | | ''' </summary> |
| | 6471 | | ''' <param name="logName"> |
| | 6472 | | ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name). |
| | 6473 | | ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used. |
| | 6474 | | ''' </param> |
| | 6475 | | ''' <param name="sourceName"> |
| | 6476 | | ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically |
| | 6477 | | ''' generated using the calling method's namespace, class, and method name. |
| | 6478 | | ''' If the source exceeds 254 characters, it is automatically truncated. |
| | 6479 | | ''' </param> |
| | 6480 | | ''' <returns></returns> |
| 64 | 6481 | | Public Function GetLog( |
| 64 | 6482 | | ByVal logName As String, |
| 64 | 6483 | | ByVal sourceName As String) As EventLog |
| | 6484 | |
|
| 128 | 6485 | | Initialize() |
| | 6486 | |
|
| 128 | 6487 | | Return GetLog( |
| 128 | 6488 | | logName, |
| 128 | 6489 | | sourceName, |
| 128 | 6490 | | MaxKilobytes, |
| 128 | 6491 | | RetentionDays) |
| | 6492 | |
|
| 128 | 6493 | | End Function |
| | 6494 | |
|
| | 6495 | | ''' <summary> |
| | 6496 | | ''' Gets the entry log class to use for writing to the event log. |
| | 6497 | | ''' </summary> |
| | 6498 | | ''' <param name="logName"> |
| | 6499 | | ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name). |
| | 6500 | | ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used. |
| | 6501 | | ''' </param> |
| | 6502 | | ''' <param name="sourceName"> |
| | 6503 | | ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically |
| | 6504 | | ''' generated using the calling method's namespace, class, and method name. |
| | 6505 | | ''' If the source exceeds 254 characters, it is automatically truncated. |
| | 6506 | | ''' </param> |
| | 6507 | | ''' <param name="maxKilobytes"> |
| | 6508 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 6509 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 6510 | | ''' </param> |
| | 6511 | | ''' <param name="retentionDays"> |
| | 6512 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 6513 | | ''' Only used when creating a new log. |
| | 6514 | | ''' </param> |
| | 6515 | | ''' <returns></returns> |
| 64 | 6516 | | Public Function GetLog( |
| 64 | 6517 | | ByVal logName As String, |
| 64 | 6518 | | ByVal sourceName As String, |
| 64 | 6519 | | ByVal maxKilobytes As Integer, |
| 64 | 6520 | | ByVal retentionDays As Integer) As EventLog |
| | 6521 | |
|
| 128 | 6522 | | Initialize() |
| | 6523 | |
|
| 128 | 6524 | | Return GetLog( |
| 128 | 6525 | | logName, |
| 128 | 6526 | | sourceName, |
| 128 | 6527 | | maxKilobytes, |
| 128 | 6528 | | retentionDays, |
| 128 | 6529 | | WriteInitEntry) |
| | 6530 | |
|
| 128 | 6531 | | End Function |
| | 6532 | |
|
| | 6533 | | ''' <summary> |
| | 6534 | | ''' Gets the entry log class to use for writing to the event log. |
| | 6535 | | ''' </summary> |
| | 6536 | | ''' <param name="logName"> |
| | 6537 | | ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name). |
| | 6538 | | ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used. |
| | 6539 | | ''' </param> |
| | 6540 | | ''' <param name="sourceName"> |
| | 6541 | | ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically |
| | 6542 | | ''' generated using the calling method's namespace, class, and method name. |
| | 6543 | | ''' If the source exceeds 254 characters, it is automatically truncated. |
| | 6544 | | ''' </param> |
| | 6545 | | ''' <param name="maxKilobytes"> |
| | 6546 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 6547 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 6548 | | ''' </param> |
| | 6549 | | ''' <param name="retentionDays"> |
| | 6550 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 6551 | | ''' Only used when creating a new log. |
| | 6552 | | ''' </param> |
| | 6553 | | ''' <param name="writeInitEntry"> |
| | 6554 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 6555 | | ''' </param> |
| | 6556 | | ''' <returns></returns> |
| 64 | 6557 | | Public Function GetLog( |
| 64 | 6558 | | ByVal logName As String, |
| 64 | 6559 | | ByVal sourceName As String, |
| 64 | 6560 | | ByVal maxKilobytes As Integer, |
| 64 | 6561 | | ByVal retentionDays As Integer, |
| 64 | 6562 | | ByVal writeInitEntry As Boolean) As EventLog |
| | 6563 | |
|
| 128 | 6564 | | Initialize() |
| | 6565 | |
|
| 128 | 6566 | | Return GetLog( |
| 128 | 6567 | | MachineName, |
| 128 | 6568 | | logName, |
| 128 | 6569 | | sourceName, |
| 128 | 6570 | | maxKilobytes, |
| 128 | 6571 | | retentionDays, |
| 128 | 6572 | | writeInitEntry) |
| | 6573 | |
|
| 128 | 6574 | | End Function |
| | 6575 | |
|
| | 6576 | | ''' <summary> |
| | 6577 | | ''' Gets the entry log class to use for writing to the event log. |
| | 6578 | | ''' </summary> |
| | 6579 | | ''' <param name="machineName"> |
| | 6580 | | ''' The name of the machine where the event log resides. Use <c>"."</c> to refer to the local machine. |
| | 6581 | | ''' If <c>null</c> or empty, the local machine is used by default, or the value in <c>MachinName</c> if set. |
| | 6582 | | ''' </param> |
| | 6583 | | ''' <param name="logName"> |
| | 6584 | | ''' The name of the event log to write to (e.g., <c>"Application"</c>, <c>"System"</c>, or a custom log name). |
| | 6585 | | ''' If <c>null</c> or empty, the value of the static <c>LogName</c> property is used. |
| | 6586 | | ''' </param> |
| | 6587 | | ''' <param name="sourceName"> |
| | 6588 | | ''' The source name to associate with the event log entry. If <c>null</c> or empty, a source is automatically |
| | 6589 | | ''' generated using the calling method's namespace, class, and method name. |
| | 6590 | | ''' If the source exceeds 254 characters, it is automatically truncated. |
| | 6591 | | ''' </param> |
| | 6592 | | ''' <param name="maxKilobytes"> |
| | 6593 | | ''' The maximum size of the event log in kilobytes. Only used when creating a new log. |
| | 6594 | | ''' Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| | 6595 | | ''' </param> |
| | 6596 | | ''' <param name="retentionDays"> |
| | 6597 | | ''' The number of days to retain event log entries. If 0, events are retained indefinitely. |
| | 6598 | | ''' Only used when creating a new log. |
| | 6599 | | ''' </param> |
| | 6600 | | ''' <param name="writeInitEntry"> |
| | 6601 | | ''' Indicates whether an initialization entry should be written when a new log is created. |
| | 6602 | | ''' </param> |
| | 6603 | | ''' <returns></returns> |
| 64 | 6604 | | Public Function GetLog( |
| 64 | 6605 | | ByVal machineName As String, |
| 64 | 6606 | | ByVal logName As String, |
| 64 | 6607 | | ByVal sourceName As String, |
| 64 | 6608 | | ByVal maxKilobytes As Integer, |
| 64 | 6609 | | ByVal retentionDays As Integer, |
| 64 | 6610 | | ByVal writeInitEntry As Boolean) As EventLog |
| | 6611 | |
|
| 128 | 6612 | | Initialize() |
| | 6613 | |
|
| 128 | 6614 | | Return _writer.GetLog( |
| 128 | 6615 | | NormalizeMachineName(machineName), |
| 128 | 6616 | | logName, |
| 128 | 6617 | | sourceName, |
| 128 | 6618 | | maxKilobytes, |
| 128 | 6619 | | retentionDays, |
| 128 | 6620 | | writeInitEntry) |
| | 6621 | |
|
| 128 | 6622 | | End Function |
| | 6623 | |
|
| | 6624 | | #End Region |
| | 6625 | |
|
| | 6626 | | End Module |