LogFusionX 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package LogFusionX --version 0.1.1                
NuGet\Install-Package LogFusionX -Version 0.1.1                
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="LogFusionX" Version="0.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LogFusionX --version 0.1.1                
#r "nuget: LogFusionX, 0.1.1"                
#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.
// Install LogFusionX as a Cake Addin
#addin nuget:?package=LogFusionX&version=0.1.1

// Install LogFusionX as a Cake Tool
#tool nuget:?package=LogFusionX&version=0.1.1                

LogFusionX

LogFusionX is a powerful logging library designed to handle different log levels, formats, and logging scenarios. It provides synchronous logging capabilities, including the ability to log to files, handle exceptions, and log warning and error messages in a straightforward manner.

Features

  • Multiple Log Levels: Support for Info, Warning, Error, and custom log levels.
  • File Logging: Logs can be written to files with flexible file and directory options.
  • Exception Handling: Log errors with detailed exception stack traces.
  • Synchronous Logging: Log entries are written synchronously, ensuring that messages are recorded in the correct order.

Installation

To install LogFusionX, use the following command:

dotnet add package LogFusionX --version 0.1.0

This will add the latest version of LogFusionX to your project.

Usage

To use LogFusionX for logging, you can follow the example below:

Example Code

using System;
using System.IO;
using LogFusionX.Core.Configurations;
using LogFusionX.Core.Loggers;

class Program
{
    static void Main(string[] args)
    {
        // Set up the logger configuration
        var options = new XFileLoggerConfigurationOptions
        {
            LogDirectory = Directory.GetCurrentDirectory() + "/AppData", // Log file directory
            LogFileName = "FusionLogs" // Log file name
        };

        // Initialize the logger with the configuration options
        var logger = new FusionXLogger(options);

        try
        {
            for (int i = 0; i < 10; i++)
            {
                // Log info messages
                if (i == 0)
                {
                    logger.Log($"Hello, this is a sync log message {i} - {DateTime.Now}, by LogFusionX");
                }
                // Log warning messages
                else if (i == 1)
                {
                    logger.LogWarning("Hi, this is a warning message", new Exception("Warning exception"));
                }
                // Simulate an error
                else
                {
                    throw new Exception("Simulated error");
                }
            }
        }
        catch (Exception ex)
        {
            // Log error messages with exception details
            logger.LogError("An error occurred while processing the loop. Please try again later.", ex);
        }

        // Synchronous Logging
        //logger.WriteLog("This is a synchronous log entry.");

        Console.WriteLine("Logs written. Press any key to exit...");
        Console.ReadKey();
    }
}

Explanation:

Logger Configuration

The XFileLoggerConfigurationOptions class is used to configure the logger. You can set the log file directory (LogDirectory) and the log file name (LogFileName).

Logging Levels:

  • Info: Logs general information.
  • Warning: Logs warning messages.
  • Error: Logs error messages along with exception details.

Exception Handling

If an exception occurs during logging, it is caught and logged using LogError.

Synchronous Logging

LogFusionX allows synchronous logging, ensuring that messages are written in the correct sequence.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Feel free to fork the repository, submit issues, or make pull requests to contribute to the development of LogFusionX.

Repository

You can find the project repository and source code here:
LogFusionX GitHub Repository


Thank you for using LogFusionX! 🎉

We hope this library makes logging in your .NET projects more powerful and easier. If you have any feedback, questions, or suggestions, feel free to reach out. Stay tuned for more features and updates in the future!

Happy Coding! 🚀

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

    • 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
0.1.4 75 12/20/2024
0.1.3 71 12/20/2024
0.1.2 72 12/19/2024
0.1.1 74 12/18/2024
0.1.0 69 12/18/2024

Initial release of LogFusionX package for enhanced logging functionality.