Skip to content

maxnatamo/Fluff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fluff

Pretty-print pretty and minimal logs for C# applications. The formatting was heavily inspired by log by Charm.

Usage

First, install the package using Nuget:

dotnet add package Fluff

Then, import it into your project:

using Fluff;

Levels

Messages sent to the logger are sent with a specific level, which defines the severity of the message.

// Debugging messages/actions.
Log.Level.Debug

// Events that may be worth noting.
Log.Level.Info

// Errors which can be handled.
Log.Level.Warning

// Critical, non-crashing errors, which may be dismissable.
Log.Level.Error

// System is unstable and/or should exit imminently
Log.Level.Fatal

By default, everything more severe than Info-messages are logged to the console.

Logger configuration

Log.Logger.Options = new Log.LogOptions
{
    IncludeCaller = true,
    IncludeTime = true,
    TimeFormat = Log.TimeFormat.Latin,
    Level = Log.Level.Warning
};

Alternatively, you can change individual fields:

Log.Logger.Options.Prefix = "Backend";

Formatting

To attach attributes to a message, you can add an object to the invocation:

Log.Debug("User logged in.", new { username = "max", ip = "localhost" });

About

A pretty, minimalist logger for .NET Core.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors