C1Logger 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package C1Logger --version 1.0.0
                    
NuGet\Install-Package C1Logger -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="C1Logger" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="C1Logger" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="C1Logger" />
                    
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 C1Logger --version 1.0.0
                    
#r "nuget: C1Logger, 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 C1Logger@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=C1Logger&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=C1Logger&version=1.0.0
                    
Install as a Cake Tool

C1Log

My Website: Corpi1.uk

C1Log is a modern, thread-safe, and highly configurable logging library for .NET applications.
It supports asynchronous logging, file rolling (by date and size), minimum log level filtering, syslog-style log levels (with shorthand), and custom log sinks for advanced scenarios.


Installation

To use this library, install it via NuGet in your project. You can do this by running the following command in the Package Manager Console:

Latest Version:

NuGet\Install-Package C1Log

Specific Version:

NuGet\Install-Package C1Log --Version x.x.x

Alternatively, search for "C1Log" in the NuGet Package Manager in Visual Studio and install it from there.


Usage

For a full usage guide, please refer to the Docs

Log Levels:

  • Emergency (emerg)
  • Alert (alert)
  • Critical (crit)
  • Error (error)
  • Warning (warn)
  • Notice (notice)
  • Informational (info)
  • Debug (debug)

Basic Examples:

Default initialization with default settings:

using C1Log;
C1Log.InitLog(); // Initialize with default settings
C1Log.Info("Application started.");
C1Log.Flush(); // Ensure all logs are written

Customizing the log directory, log level and format:

using C1Log;
C1Log.InitLog(
        new C1LogConfig { 
            LogDirectory = @"C:\Logs", // Specify your log directory
            MinLogLevel = C1Log.LogLevel.Warning, // Set minimum log level to Warning
            Formatter = (dt, lvl, msg) => $"[{lvl.ShortHand()}] {dt:HH:mm:ss} - {msg}" // Custom log message to use shorthand
        }
    );
C1Log.Info("Application started.");
C1Log.Error("An error occurred.");
C1Log.Flush(); // Ensure all logs are written

Full API Example:

using System;
using C1Log;
public class MyCustomSink : C1Log.ILogSink { 
public void Write(string message, C1Log.LogLevel level) 

class Program { static void Main() 
    { 
        // Configure logger 
        var config = new C1LogConfig { 
            = @"C:\Logs", 
            MinLogLevel = C1Log.LogLevel.Notice, 
            Formatter = (dt, lvl, msg) => $"[{lvl.ShortHand()}] {dt:HH:mm:ss} - {msg}" 
            C1LogConfig.Sinks.Add(new MyCustomSink());
        }; 

        C1Log.InitLog(config);

        // Subscribe to logging failures
        C1Log.OnLoggingFailure += ex => Console.Error.WriteLine($"Logging failed: {ex}");

        // Log messages
        C1Log.Info("Informational message.");
        C1Log.Warning("Warning message.");
        C1Log.Error("Error message.");
        C1Log.Exception(new Exception("Test exception"));
        C1Log.Flush(); // Ensure all logs are written

    }
}

Building

If you want to build the project yourself, follow these steps:

  1. Install Visual Studio (Community Edition is sufficient).
    • Select the .NET desktop development workload during installation.
  2. Clone the repository to your local machine using Git or download it as a ZIP file.
  3. Open the folder in Visual Studio as a new project.
  4. Build the project by selecting Build > Build Solution or pressing Ctrl + Shift + B.
    • This should install all required dependencies. If not, manually install them via Manage NuGet Packages.
  5. Once the build completes, you can run it:
    1. From Visual Studio: Debug > Start Debugging or F5
    2. From the built executable in \bin\Debug\net8.0 (or Release for release builds).

License

This project is licensed under the Corpi1 Software License (Based on Mozilla Public License 2.0).

You are free to use, modify, and distribute the software. Businesses and individuals can use it, including in commercial activities. However, you may not sell, repackage, or monetize the software itself.

See the LICENSE file for full terms.

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

    • 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

Initial