AnointedAutomation.Logging 1.0.6

dotnet add package AnointedAutomation.Logging --version 1.0.6
                    
NuGet\Install-Package AnointedAutomation.Logging -Version 1.0.6
                    
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="AnointedAutomation.Logging" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AnointedAutomation.Logging" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="AnointedAutomation.Logging" />
                    
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 AnointedAutomation.Logging --version 1.0.6
                    
#r "nuget: AnointedAutomation.Logging, 1.0.6"
                    
#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 AnointedAutomation.Logging@1.0.6
                    
#: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=AnointedAutomation.Logging&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=AnointedAutomation.Logging&version=1.0.6
                    
Install as a Cake Tool

AnointedAutomation.Logging

Jesus is King ✝️

A small log message model with no dependencies for .NET. LogMessage captures the message, severity, timestamp, program name and calling method, and raises a static event every time one is created so you can route logs wherever you like.

NuGet Downloads

Installation

dotnet add package AnointedAutomation.Logging
  • Target framework: net10.0
  • Dependencies: none

Quick start

using System;
using AnointedAutomation.Optimization.Logging;

// Name your program once at startup; every LogMessage copies it into messageSource.
LogMessage.MessageSourceSetter = "MyApplication";

// Subscribe once; the event fires from every LogMessage constructor.
LogMessage.LogAdded += (sender, e) =>
{
    Console.WriteLine($"{e.log.timeStamp:O} [{e.log.messageType}] {e.log.localOperationName}: {e.log.message}");
};

LogMessage.Info("Application started.");
LogMessage.Warning(42, "Cache miss rate is high.");
LogMessage.Error("Could not reach the payment provider.");

Note the namespace: the types live in AnointedAutomation.Optimization.Logging, not AnointedAutomation.Logging.

API overview

All types are in the AnointedAutomation.Optimization.Logging namespace.

LogMessage

Member Description
LogMessage() Empty instance (no event raised).
LogMessage(MessageType messageType, string message) Sets timeStamp (DateTime.Now), messageSource, localOperationName and raises LogAdded.
LogMessage(int id, MessageType messageType, string message) Same as above, with an id.
static string MessageSourceSetter Program name copied into every new message's messageSource.
static event LogAddedEventHandler LogAdded Raised whenever a message is constructed with a type and text.
long id Optional identifier.
string localOperationName Calling method, resolved from the stack trace (Namespace.Class.Method). Async state machines and lambdas are unwrapped to the real method name.
string message The log text.
string messageSource Program name (from MessageSourceSetter).
MessageType messageType Severity.
DateTime timeStamp Local creation time.

Static factory methods, each with a (string message) and an (int id, string message) overload:

Factory Produces
LogMessage.Celebrate MessageType.Celebrate
LogMessage.Critical MessageType.Critical
LogMessage.Error MessageType.Error
LogMessage.Info / LogMessage.Informational MessageType.Informational
LogMessage.Message MessageType.Message
LogMessage.Success MessageType.Success
LogMessage.Warning MessageType.Warning

LogMessageEventArgs

EventArgs passed to LogAdded; the message is exposed as the log property. The delegate is LogMessage.LogAddedEventHandler(object sender, LogMessageEventArgs e).

MessageType

enum MessageType : int

Value Number Meaning
Error 0 An error that should be investigated
Warning 1 A potential issue
Success 2 A successful operation
Informational 3 General information
Message 4 A general message with no severity
Critical 5 A severe error needing immediate attention
Celebrate 6 A milestone or achievement

Notes

  • LogAdded is a static event. Every LogMessage created anywhere in the process reaches every subscriber, so subscribe once and unsubscribe when your listener goes away.
  • Creating a message captures a StackTrace, which is relatively expensive; avoid creating messages in very hot loops.

Other AnointedAutomation packages build on this one and expose their own log buffers of LogMessage:

License

MIT. See LICENSE.

Support This Project

This library is free and open source. The best way to support the work is to shop with us:

Found a bug or have a request? Open an issue at https://github.com/AnointedAutomation/AnointedAutomation/issues.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on AnointedAutomation.Logging:

Package Downloads
AnointedAutomation.Repository.Mongo

A MongoDB helper and generic repository base for .NET, with CRUD, paging, aggregation, index management, BSON class maps and casing conventions.

AnointedAutomation.APIMiddlewares

ASP.NET Core middleware and filters for API key authentication, IP blacklisting, invalid endpoint tracking and idle time memory cleanup.

AnointedAutomation.Repository.MySql

A generic repository and helper for MySQL over Entity Framework Core and the Pomelo provider.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.6 127 10/26/2026
1.0.5 592 10/1/2026
1.0.4 157 10/1/2026
1.0.3 287 9/25/2026
1.0.2 647 8/23/2026
1.0.1 1,282 5/30/2026
1.0.0 1,035 3/15/2026
0.0.10 321 3/13/2026
0.0.9 211 3/11/2026
0.0.8 780 2/17/2026