FastLog.Net 1.0.0

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

// Install FastLog.Net as a Cake Tool
#tool nuget:?package=FastLog.Net&version=1.0.0                

<p align="center"> <img src="https://github.com/ShayanFiroozi/FastLog.Net/blob/master/FastLog.Net/Icon/FastLogNet.ico" </p>

FastLog.Net

FastLog.Net is the fastest , most efficient and high performance logger for .Net

✔ Easy to use and develop , clean code , extensible agents and log model , and also designed to be fully thread-safe.

✔ FastLog.Net supports structured logging and enhanced Json format for Exception class.

✔ FastLog.Net uses thread-safe queueing technique to enqueue the logging request(s) and release your thread
    almost immediately after you call a logging method.

✔ FastLog.Net uses fluent builder pattern to create the logger object easily.

<br/>

💯Features

**FastLog.Net features 😗*

  • **Supported Logging Events 😗*

    • INFO
    • NOTE
    • TODO
    • WARNING
    • ALERT
    • DEBUG
    • ERROR
    • EXCEPTION (specially designed for .Net Exception class to keep all details with nice json format)
    • SYSTEM
    • SECURITY
      <br/>
  • **Agents 😗*

    • Text File Agent which supports both plain text and json format with ability to handle log file max size.

    • Colorized Console Agent which also supports text and json output.

    • Beep Agent (works only on Windows® OS) which is resposible to make beep sound from BIOS or system speaker with fully customizable event type.

    • Debug/Trace Agents help you to log your events on debug or trace system.

    • Run Process Agent will run a specific process in "Noraml" or "As administrator" privileges , based on a specific or all events.

    • Method Execution Agent will call a method in your code , based on a specific or all events.

    • Heavy Operation Simulator Agent simulates an heavy IO bound operation (like email sending or http operation) , this agent is used for testing the FastLog.Net or create a delay intentionally between the agents.

      • Note: All agents support Event Type filtering , so you can easily specify that your agent should be executed on which event type(s).
        For example: You can add a "Beep Agent" with "Exception" log event , so the beep agent will only execute on "Exceptions" not other logging events.

<br/>

  • Internal Events Logger:

    • FastLog.Net has a powerful and structured internal logging system to log and monitor internal exceptions or event which occured in the library itself !
      <br/>
  • Thread Safety:

    • FastLog.Net has an internal queue list which is designed fully thread-safe , it's really not matter how many thread(s) call the logging methods simultaneously , it will get your request(s) and put in the queue and immediately release your thread ! Then process your logging request(s) in the background.

<br/>

🤝Contributions

Since this is a new repository , there's no contributor yet! , But FastLog.Net welcomes and appreciates any contribution , pull request or bug report.

If you'd like to contribute, please read the How It Works section and then take a look at ToDo List to get involved !

Note : The srouce code is fully commented.

<br/>

❔ How To Use

Step 1 :

  • Build a Internal Logger agent with fluent builder pattern :
InternalLogger internalLogger = InternalLogger.Create()
                                              .UseJsonFormat()
                                              .SaveInternalEventsToFile(@"Logs\InternalEventsLog.log")
                                              .DeleteTheLogFileWhenExceededTheMaximumSizeOf(20)
                                              .PrintOnConsole();

  Note: Internal logger agent is responsible for logging the events occured in the FastLog.Net internally (including exceptions).

Step 2 :

  • Build Logger Configuration with fluent builder pattern :
ConfigManager loggerConfig = ConfigManager.Create()
                                          .WithLoggerName("FastLog.Net® Logger")
                                          .WithMaxEventsToKeepInMemory(1_000);

   Note: There is "RunAgentsInParallelMode" feature you can use to run agent(s) in parallel , but in most cases it's NOT recommended because may have considerable negative impact on performance.

Step 3 :

  • Build Logger with fluent builder pattern :
Logger fastLogger = Logger.Create()
                          .WithInternalLogger(internalLogger)
                          .WithConfiguration(loggerConfig)
                          .WithAgents()


// Add a "Console Agent" with Json format.
                             .AddConsoleAgent()
                              .UseJsonFormat()
                             .BuildAgent()


// Add a "Beep Agent".
                             .AddBeepAgent().BuildAgent()


// Add a "Debug System Agent".
                             .AddDebugSystemAgent().BuildAgent()


// Add a "TextFile Agent" with Json format and will be re-created when reached to 10 megabytes.
                             .AddTextFileAgent()
                              .UseJsonFormat()
                              .SaveLogToFile("Logs\\TestLog.json")
                              .DeleteTheLogFileWhenExceededTheMaximumSizeOf(10)
                             .BuildAgent()


// Add a "TextFile Agent" with Plain format and will be re-created when reached to 20 megabytes.
                             .AddTextFileAgent()
                              .SaveLogToFile("Logs\\TestLogPlain.txt")
                              .DeleteTheLogFileWhenExceededTheMaximumSizeOf(20)
                             .BuildAgent()


// And Finally build the logger.
                           .BuildLogger();


// To Start the FastLog.Net engine.
// Important : DO NOT await "StartLogger" method because it runs infinitely ! , Just call and discard the result ;)
     _= fastLogger.StartLogger();

Final Step :

  • FastLog.Net is ready , just call a logging method from anywhere of your code :
_= fastLogger.LogInfo("This is test logging INFO event);

await fastLogger.LogException(new InvalidOperationException());

await fastLogger.LogException(new Exception("This is a test exception i want to throw !!"));

await fastLogger.LogSystem("The system is gonna be restarted !");

<br/>

❓ How It Works

Soon...

<br/>

❌ Limitations

  • However the FastLog.Net is thread-safe BUT it is NOT recommended to build two or more agents with the same logging file , so this limitation applied to the FastLog.Net intentionally to prevent two or more agents write and manage the same logging file.

  • The FastLog.Net queue has been limited to handle up to the 1,000,000 logging events at the same time.This limitation has been set to prevent uncontrolled memory usage.

<br/>

‼ Known Issues

Not Reported Yet! 😎

<br/>

© License

FastLog.Net is an open source software, licensed under the terms of MIT license. See LICENSE for more details.

<br/>

🛠 How to build

Use Visual Studio 2022 and open the solution 'FastLog.Net.sln'.

FastLog.Net solution is setup to support following .Net versions :

  • .Net Core 7.0
  • .Net Core 6.0
  • .Net Framework 4.8

Note : Since the FastLog.Net solution is supporting multi target frameworks , to build the solution successfully you should install all .Net versions above , otherwise you can easily exclude not interested framework(s) by editing TargetFrameworks tag in the FastLog.Net Project File.

<br/>

Donations

If you would like to financially support FastLog.Net, first of all, thank you! Please read DONATIONS for my crypto wallets !

<br/>

Version History

Please read CHANGELOG for more and track changing details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.1.8568 840 6/17/2023
1.1.8566.1 681 6/15/2023
1.1.8566 663 6/14/2023
1.1.8564 656 6/13/2023
1.1.8555 651 6/4/2023
1.1.8552 651 6/1/2023
1.1.8551 662 5/31/2023
1.1.8550 652 5/29/2023
1.1.8548 661 5/28/2023
1.1.8547 645 5/27/2023
1.0.0 641 5/27/2023