-
Notifications
You must be signed in to change notification settings - Fork 0
net90_EventLogHelper_SmartEventLogger_Log
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, byte[] rawData)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string source, string message)| parameter | description |
|---|---|
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, byte[] rawData, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, byte[] rawData)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, int maxKilobytes, int retentionDays)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string source, string message, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, byte[] rawData,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, byte[] rawData)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int maxKilobytes,
int retentionDays)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, int maxKilobytes, int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, int maxKilobytes, int retentionDays,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType, int eventID)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message,
EventLogEntryType eventType)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, byte[] rawData,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int maxKilobytes,
int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, int maxKilobytes,
int retentionDays)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int maxKilobytes,
int retentionDays, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
byte[] rawData)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, int maxKilobytes, int retentionDays, bool writeInitEntry,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType, int eventID,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType, int eventID,
short category)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message,
EventLogEntryType eventType, int eventID)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message,
EventLogEntryType eventType, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int maxKilobytes,
int retentionDays, bool writeInitEntry, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, int maxKilobytes,
int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, int maxKilobytes,
int retentionDays, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
byte[] rawData, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
int maxKilobytes, int retentionDays)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType, int eventID,
short category, byte[] rawData)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType, int eventID,
short category, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message,
EventLogEntryType eventType, int eventID, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message,
EventLogEntryType eventType, int eventID, short category)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, int maxKilobytes,
int retentionDays, bool writeInitEntry, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
byte[] rawData, int maxKilobytes, int retentionDays)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
int maxKilobytes, int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
int maxKilobytes, int retentionDays, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType, int eventID,
short category, byte[] rawData, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string source, string message, EventLogEntryType eventType,
int eventID, short category, byte[] rawData)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message,
EventLogEntryType eventType, int eventID, short category, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
byte[] rawData, int maxKilobytes, int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
byte[] rawData, int maxKilobytes, int retentionDays, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
int maxKilobytes, int retentionDays, bool writeInitEntry, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string source, string message, EventLogEntryType eventType, int eventID,
short category, byte[] rawData, int maxKilobytes, int retentionDays)| parameter | description |
|---|---|
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string source, string message, EventLogEntryType eventType,
int eventID, short category, byte[] rawData, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string machineName, string logName, string source, string message,
EventLogEntryType eventType, int eventID, short category, byte[] rawData)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string message, EventLogEntryType eventType, int eventID, short category,
byte[] rawData, int maxKilobytes, int retentionDays, bool writeInitEntry,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType, int eventID,
short category, byte[] rawData, int maxKilobytes, int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string source, string message, EventLogEntryType eventType, int eventID,
short category, byte[] rawData, int maxKilobytes, int retentionDays,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string source, string message, EventLogEntryType eventType,
int eventID, short category, byte[] rawData, int maxKilobytes, int retentionDays)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string machineName, string logName, string source, string message,
EventLogEntryType eventType, int eventID, short category, byte[] rawData, int maxKilobytes)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string machineName, string logName, string source, string message,
EventLogEntryType eventType, int eventID, short category, byte[] rawData,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string sourceName, string message, EventLogEntryType eventType, int eventID,
short category, byte[] rawData, int maxKilobytes, int retentionDays, bool writeInitEntry,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message,
EventLogEntryType eventType, int eventID, short category, byte[] rawData, int maxKilobytes,
int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string source, string message, EventLogEntryType eventType,
int eventID, short category, byte[] rawData, int maxKilobytes, int retentionDays,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string machineName, string logName, string source, string message,
EventLogEntryType eventType, int eventID, short category, byte[] rawData, int maxKilobytes,
int retentionDays)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string machineName, string logName, string source, string message,
EventLogEntryType eventType, int eventID, short category, byte[] rawData, int maxKilobytes,
LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string logName, string sourceName, string message,
EventLogEntryType eventType, int eventID, short category, byte[] rawData, int maxKilobytes,
int retentionDays, bool writeInitEntry, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| sourceName | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry (or entries) to the Windows Event Log using the specified parameters.
public static void Log(string targetMachineName, string targetLogName, string sourceName,
string message, EventLogEntryType eventType, int eventID, short category, byte[] rawData,
int maxKilobytes, int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| targetMachineName | The name of the machine where the event log resides. Use "." for the local machine. If null or empty, the local machine is used by default, or the value of the MachineName property if set. |
| targetLogName | The name of the event log (e.g., "Application", "System", or a custom log name). If null or empty, the value of the LogName property is used. |
| sourceName | The source name for the event entry. If null or empty, a source is auto-generated from the calling method's namespace, class, and method name. If the resulting name exceeds 254 characters, it will be truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier. Application-defined and useful for grouping related events. |
| category | The category ID for the event. Use 0 if not applicable. |
| rawData | Optional binary data to associate with the event. Can be null. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only applies when creating a new log. Range: 64 KB � 4 GB. |
| retentionDays | The number of days entries should be retained. 0 means entries are kept indefinitely. Applies only when creating a new log. |
| writeInitEntry | Whether to write an initialization entry when a new log is created. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry to the Windows Event Log using the provided parameters.
public static void Log(string machineName, string logName, string source, string message,
EventLogEntryType eventType, int eventID, short category, byte[] rawData, int maxKilobytes,
int retentionDays, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, "Application" is used by default. |
| source | The source of the log entry. If null or empty, a default source is generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier for the log entry. This is application-defined and may be used to group similar events. |
| category | The category for the event, if applicable. This is typically used in categorized event views. |
| rawData | Optional binary data to include with the log entry. Can be null if not used. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Writes an entry (or entries) to the Windows Event Log using the specified parameters.
public static void Log(string targetMachineName, string targetLogName, string sourceName,
string message, EventLogEntryType eventType, int eventID, short category, byte[] rawData,
int maxKilobytes, int retentionDays, bool writeInitEntry, LoggingSeverity EntrySeverity)| parameter | description |
|---|---|
| targetMachineName | The name of the machine where the event log resides. Use "." for the local machine. If null or empty, the local machine is used by default, or the value of the MachineName property if set. |
| targetLogName | The name of the event log (e.g., "Application", "System", or a custom log name). If null or empty, the value of the LogName property is used. |
| sourceName | The source name for the event entry. If null or empty, a source is auto-generated from the calling method's namespace, class, and method name. If the resulting name exceeds 254 characters, it will be truncated. |
| message | The message to log. If null or empty, a default message is used. If AllowMultiEntryMessages is false (default), messages longer than 32,766 characters are truncated and suffixed with the TruncationMarker (e.g., "... [TRUNCATED]"). If AllowMultiEntryMessages is true, long messages are split into multiple event entries, each prefixed with part information (e.g., [Part 1/3]) and intermediate entries are suffixed with the ContinuationMarker (e.g., " ...") to indicate continuation. |
| eventType | The type of event. Valid values are Error, Warning, and Information. If invalid, Information is used. |
| eventID | The numeric event identifier. Application-defined and useful for grouping related events. |
| category | The category ID for the event. Use 0 if not applicable. |
| rawData | Optional binary data to associate with the event. Can be null. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only applies when creating a new log. Range: 64 KB � 4 GB. |
| retentionDays | The number of days entries should be retained. 0 means entries are kept indefinitely. Applies only when creating a new log. |
| writeInitEntry | Whether to write an initialization entry when a new log is created. |
| EntrySeverity | Indicates the importance or severity of this log entry relative to the configured logging threshold (CurrentLoggingLevel). If the severity is lower than the current logging level, the entry will be skipped and not written to the Event Log. |
If the specified event log or source does not exist, they are created automatically using the provided parameters.
This method handles safe formatting, validation, and optional message splitting to avoid truncation of diagnostic content.
- enum LoggingSeverity
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper