DR.Logging 1.0.1

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

// Install DR.Logging as a Cake Tool
#tool nuget:?package=DR.Logging&version=1.0.1                

DR.Logging

A small logging library.

Usage

using DR.Logging;

namespace DRL_Console
{
    internal class Program
    {
        static void Main(string[] args)
        {
            // Write logs with the default settings
            Log.Debug("Debug");
            Log.Trace("Trace");
            Log.Info("Info");
            Log.Warn("Warning");
            Log.Error("Error");
            Log.Fatal("Fatal");

            // Specify if the library logs to the console
            bool logToConsole = true;

            // Make the library output log results to a .json file
            string logPath = $"{Assembly.GetEntryAssembly().Location}/logging.json";

            // Set the maximum size of a log file (example has a max size of 1 MB)
            int maxSize = 1000000;

            // Set what timezone the library uses
            TimeZoneInfo timezone = TimeZoneInfo.FindSystemTimeZoneById("Central America Standard Time")

            // Set what colors the library uses for different log levels (use either RGB or HEX).
            // NOTE: not all consoles/terminals support all colors.
            // This library uses https://spectreconsole.net/ to show colors in console.
            Configuration.Colors colors = new()
            {
                Debug = "0, 175, 255",
                Trace = "#00d700",
                Info = "69, 174, 206",
                Warn = "#5f00ff",
                Error = "95,135,135",
                Fatal = "#5f5f00",
            };

            // Customize what settings the library uses.
            // NOTE: you only need to set this once. These settings will be applied globally
            _ = new Configuration(logToConsole, logPath, maxSize, timezone, colors);

            // Log with new settings applied
            Log.Debug("Debug");
            Log.Trace("Trace");
            Log.Info("Info");
            Log.Warn("Warning");
            Log.Error("Error");
            Log.Fatal("Fatal");
        }
    }
}

This library uses Spectre.Console to show colors in console. If the colors you specified don't show make sure the console/terminal you're using actually support them.

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.

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.0.1 363 11/24/2022
1.0.0 344 10/31/2022

Decreased the amount of times the console is being written to