NetTools.Logging
1.2.1
See the version list below for details.
dotnet add package NetTools.Logging --version 1.2.1
NuGet\Install-Package NetTools.Logging -Version 1.2.1
<PackageReference Include="NetTools.Logging" Version="1.2.1" />
<PackageVersion Include="NetTools.Logging" Version="1.2.1" />
<PackageReference Include="NetTools.Logging" />
paket add NetTools.Logging --version 1.2.1
#r "nuget: NetTools.Logging, 1.2.1"
#:package NetTools.Logging@1.2.1
#addin nuget:?package=NetTools.Logging&version=1.2.1
#tool nuget:?package=NetTools.Logging&version=1.2.1
NetTools.Logging
NetTools.Logging is a lightweight and standardized .NET logging library that enables multiple logging implementations across applications. By leveraging a centralized Loggers
class, developers can register and invoke logging across multiple loggers with ease.
This library is designed to provide extensibility while maintaining simplicity, allowing users to integrate their own logging mechanism by implementing the ILogger
interface.
Features
- Multi-Logger Support: Register multiple loggers to handle different logging methods.
- Easy Integration: Implement
ILogger
to create custom loggers that follow a strict design pattern. - Flexible Usage: Invoke logging methods across all registered loggers using the central
Loggers
class.
Getting Started
Installation
To use NetTools.Logging, add the library via NuGet Package Manager:
Install-Package NetTools.Logging
Quick Examples
Adding a Custom Logger
This library itself doesn't do any logging, and is designed to strictly enforce interface logging across multiple loggers. First, you need to create a logger implementing ILogger:
using System;
using NetTools.Logging;
// This is an incredibly simple implementation of the ILogger interface.
public class ConsoleLogger : ILogger
{
public void Log(params object[] args) => Console.WriteLine($"{string.Join(" ", args)}");
}
Then, add the custom logger to NetTools.Logging.Log
loggers:
Log.AddLogger(new ConsoleLogger());
Logging Messages
Once the logger has been registered, you can use the Log class to log messages, this will invoke logging on all added loggers:
Loggers.Log("ERROR", "An error occurred in the system.");
Loggers.Log("User logged in at", DateTime.UtcNow);
Loggers.Log("Service started successfully.");
Loggers.Log("Debugging mode enabled.");
This simple library is used by NetModules.Logging.LocalLogging, a simple, commercially battle tested, NetModules module for logging module messages to local files.
Contributing
We welcome contributions! To get involved:
- Fork NetTools.Logging, make improvements, and submit a pull request.
- Code will be reviewed upon submission.
- Join discussions via the issues board.
License
NetModules is licensed under the MIT License, allowing unrestricted use, modification, and distribution. If you use NetTools.Logging in your own project, we’d love to hear about your experience, and possibly feature you on our website!
Full documentation coming soon!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on NetTools.Logging:
Package | Downloads |
---|---|
NetModules.Logging.LocalLogging
A basic logging module. This module writes any NetModules.LoggingEvent data to the console output where available and also writes logs to a file in the Module.WorkingDirectory path using log rotation. |
GitHub repositories
This package is not used by any popular GitHub repositories.