AnointedAutomation.Logging 1.0.0

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

AnointedAutomation.Logging

Overview

The AnointedAutomation.Logging library provides a robust and flexible logging framework for .NET applications. It features a standardized LogMessage class that allows developers to create and manage detailed log entries efficiently. With support for various log message types and event-driven logging, this library is designed to streamline application monitoring and debugging.


Features

  • Standardized Log Object: Encapsulates log details like message type, timestamp, and source.
  • Event-Driven Logging: Triggers events when new log messages are added.
  • Predefined Log Levels: Includes types such as Informational, Warning, Error, Critical, Success, and more.
  • Static Factory Methods: Simplifies log creation with utility methods.
  • Source Tracking: Automatically captures the source of the log within the application.

Installation

Include the library in your .NET project and reference the AnointedAutomation.Logging namespace.


Usage

Import the Namespace

using AnointedAutomation.Logging;

LogMessage Class

The LogMessage class serves as the core object for capturing log details. It supports multiple constructors and static factory methods for creating various types of log entries.

Properties
  • id: Unique identifier for the log message.
  • localOperationName: Captures the name of the method generating the log.
  • message: The content of the log entry.
  • messageSource: A customizable identifier for the program or module generating the log.
  • messageType: Categorizes the log (e.g., Informational, Error).
  • timeStamp: Timestamp when the log was created.

Creating Logs

Using Constructors
LogMessage log = new LogMessage(MessageType.Informational, "This is an informational message.");
Using Static Methods
LogMessage infoLog = LogMessage.Informational("This is an informational message.");
LogMessage errorLog = LogMessage.Error("An error occurred while processing the request.");
Example with IDs
LogMessage successLog = LogMessage.Success(1, "Operation completed successfully.");
LogMessage warningLog = LogMessage.Warning(2, "This is a warning message.");

Events

LogAdded Event

Triggered whenever a new log message is created.

LogMessage.LogAdded += (sender, args) =>
{
    Console.WriteLine($"Log Added: {args.log.message}");
};

Log Types

The LogMessage class supports several predefined log types:

Type Description
Celebrate Logs celebrating a milestone or achievement.
Critical Logs critical issues that require immediate attention.
Error Logs errors encountered during execution.
Informational Logs general information about operations.
Message Logs a general-purpose message.
Success Logs successful operations or results.
Warning Logs warnings that may require attention.

Example Usage

Basic Logging
LogMessage.LogAdded += (sender, args) =>
{
    Console.WriteLine($"Log: {args.log.timeStamp} - {args.log.messageType} - {args.log.message}");
};

LogMessage log = LogMessage.Error("A critical error occurred.");
Customizing the Message Source
LogMessage.MessageSourceSetter = "MyApplication";
LogMessage log = LogMessage.Success("Application started successfully.");

Requirements

  • .NET Framework or .NET Core

License

This project is copyrighted © 2023 Anointed Automation, LLC.
All Rights Reserved.


Author

Created by Alexander Fields For inquiries, please contact Anointed Automation. GitHub: https://github.com/AnointedAutomation

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

Repository for Generic Mongo Usage - AnointedAutomation.Repository.Mongo

AnointedAutomation.APIMiddlewares

Middlewares for APIs - AnointedAutomation.APIMiddlewares

AnointedAutomation.Repository.MySql

Repository for Generic MySQL Usage with Entity Framework Core - AnointedAutomation.Repository.MySql

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 201 3/15/2026
0.0.10 268 3/13/2026
0.0.9 151 3/11/2026
0.0.8 732 2/17/2026