EventLogHelper 2025.8.16.1
See the version list below for details.
dotnet add package EventLogHelper --version 2025.8.16.1
NuGet\Install-Package EventLogHelper -Version 2025.8.16.1
<PackageReference Include="EventLogHelper" Version="2025.8.16.1" />
<PackageVersion Include="EventLogHelper" Version="2025.8.16.1" />
<PackageReference Include="EventLogHelper" />
paket add EventLogHelper --version 2025.8.16.1
#r "nuget: EventLogHelper, 2025.8.16.1"
#:package EventLogHelper@2025.8.16.1
#addin nuget:?package=EventLogHelper&version=2025.8.16.1
#tool nuget:?package=EventLogHelper&version=2025.8.16.1
EventLogHelper
EventLogHelper is a lightweight .NET library designed to make logging to the Windows Event Log simple, safe, and flexible β without requiring repetitive boilerplate or administrative headaches.
π Features
- β One-line logging to the Windows Event Log
- β Automatically creates event sources (with safe fallbacks)
- β Works in non-elevated environments
- β Configurable defaults via App.config, Web.config, or appsettings.json (automatically loaded at first use)
- β Gracefully handles permission issues and registry conflicts
- β Configurable logging severity (filter logs by importance)
π‘ Why Use EventLogHelper?
The built-in .NET
System.Diagnostics.EventLog
API requires:
- Admin rights to create sources
- Manually checking for source/log conflicts
- Verbose, repeated code everywhere you want to log
EventLogHelper abstracts all that into a single method call, with smart defaults and self-healing behavior.
π§Ύ Example Usage
Basic logging with default source and log name:
SmartEventLogger.Log("Application started.")
SmartEventLogger.Log("A warning occurred.", EventLogEntryType.Warning)
SmartEventLogger.Log("An error occurred.", EventLogEntryType.Error)
Custom source and log name:
SmartEventLogger.MachineName = "."
SmartEventLogger.LogName = "MyCompanyLog"
SmartEventLogger.SourceName = "MyServiceSource"
SmartEventLogger.Log("Service initialized.",
EventLogEntryType.Information)
Or with a fluent interface using GetLog
:
SmartEventLogger.GetLog("MyCompanyLog", "MyServiceSource").
LogEntry("Service initialized.", EventLogEntryType.Information)
Advanced usage with full customization:
SmartEventLogger.Log(
_machineName: ".",
_logName: "CustomLog",
sourceName: "CustomSource",
message: "This is a custom log entry.",
eventType: EventLogEntryType.Information,
eventID: 1001,
category: 0,
rawData: Nothing,
maxKilobytes: 1024 * 1024, ' 1 GB
retentionDays: 7,
writeInitEntry: True,
EntrySeverity: LoggingSeverity.Info)
You can also configure default values and plug in a custom writer for unit testing or specialized behavior.
βοΈ Configuration via App Settings
SmartEventLogger can initialize itself automatically using application configuration files:
.NET Framework β settings are read from <appSettings> in App.config or Web.config.
.NET Core / .NET 5+ β settings are read from appsettings.json.
If you donβt call InitializeConfiguration() explicitly, these settings will be loaded automatically the first time you use the logger.
π Security Notes
- Creating new sources requires admin privileges.
- In non-elevated environments, EventLogHelper will automatically fall back to an existing source (e.g., the log name or "Application").
π License
MIT License. See LICENSE for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows10.0.17763 is compatible. net9.0-windows was computed. net9.0-windows10.0.17763 is compatible. net10.0-windows was computed. |
.NET Framework | net35 is compatible. net40 was computed. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 is compatible. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2025.9.10.2 | 37 | 9/10/2025 |
2025.9.8.1 | 50 | 9/8/2025 |
2025.8.18.1 | 129 | 8/19/2025 |
2025.8.17.2 | 127 | 8/18/2025 |
2025.8.17.1 | 124 | 8/18/2025 |
2025.8.16.1 | 56 | 8/16/2025 |
2025.8.10.1 | 126 | 8/11/2025 |
2025.8.7.1 | 208 | 8/7/2025 |
2025.8.3.1 | 168 | 8/4/2025 |
2025.8.2.1 | 68 | 8/2/2025 |
2025.7.26.13 | 107 | 7/27/2025 |