EventLogHelper 2025.7.26.13

There is a newer version of this package available.
See the version list below for details.
dotnet add package EventLogHelper --version 2025.7.26.13
                    
NuGet\Install-Package EventLogHelper -Version 2025.7.26.13
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EventLogHelper" Version="2025.7.26.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EventLogHelper" Version="2025.7.26.13" />
                    
Directory.Packages.props
<PackageReference Include="EventLogHelper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EventLogHelper --version 2025.7.26.13
                    
#r "nuget: EventLogHelper, 2025.7.26.13"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EventLogHelper@2025.7.26.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EventLogHelper&version=2025.7.26.13
                    
Install as a Cake Addin
#tool nuget:?package=EventLogHelper&version=2025.7.26.13
                    
Install as a Cake Tool

PropertyGridHelpers Icon 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 fall back)
  • โœ… Works in non-elevated environments
  • โœ… Configurable defaults via App.config or Web.config
  • โœ… Gracefully handles permission issues and registry conflicts
  • โœ… Supports structured messages and custom log levels

๐Ÿ’ก 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.


๐Ÿ› ๏ธ Installation

You can add EventLogHelper to your project by cloning or adding the source file directly (NuGet package coming soon).


๐Ÿงพ Example Usage

using EventLogHelper;

SmartEventLogger.Log("App started.");
SmartEventLogger.Log("Invalid user input", EventLogEntryType.Warning);
SmartEventLogger.Log("Fatal error", EventLogEntryType.Error);

You can optionally specify the source and log:

SmartEventLogger.Log("Service initialized.", EventLogEntryType.Information, source: "MyService", logName: "MyCompanyLog");

โš™๏ธ Configuration (App.config)

<configuration>
  <appSettings>
    <add key="EventLog.DefaultLogName" value="Application" />
    <add key="EventLog.DefaultSource" value="MyApp" />
    <add key="EventLog.FallbackToLogNameOnError" value="true" />
    <add key="EventLog.LogLevel" value="Information" />
  </appSettings>
</configuration>

๐Ÿ”’ 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").

๐Ÿ“ฆ Roadmap

  • Structured logging support
  • Optional fallback to file or ETW

๐Ÿ™Œ Contributions

Contributions are welcome! Please file issues or open pull requests to suggest improvements, report bugs, or extend functionality.


๐Ÿ“„ License

MIT License. See LICENSE for details.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 39 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 69 8/2/2025
2025.7.26.13 107 7/27/2025