FSLogger 2.4.22

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

// Install FSLogger as a Cake Tool
#tool nuget:?package=FSLogger&version=2.4.22                

F#ing Simple Logger

An rich, simple, and efficient purely functional micro logging library for F#.

This isn't frequently updated because it's literally perfect (well, probably, almost).

HOW TO LOG STUFF:

open FSLogger
let log = Logger.ColorConsole
log.I "Uzing da librariez" // log to info
log.W "%d out of %d developers recommend FsLogger" 5 5 // log to warning with format features

Is that it?

Okay fine. The library can do a bunch of stuff.

More examples

Setting a path to log stuff to:

open FSLogger

let log = 
    Logger.ColorConsole
    |> Logger.withPath "MyApp"

module SeriousBusiness = 
    let doStuff (log: Logger) (aNumber: int) =
        // shadow with a better path
        let log =  log |> Logger.appendPath "doStuff"
        if aNumber > 5 then
            log.W "Oh no, %d is bigger than 5!" aNumber
        // do something important
		ignore aNumber

Adding a custom consumer:

let enterpriseConsumer (l:LogEntry) = 
	match l.Level with
	| LogLevel.Warn -> callManagement(l.Message)
	| LogLevel.Error -> blameAnotherDeveloper(l.Message)
	| LogLevel.Fatal -> submitNewJobApplication()
	| _ -> () // ignore the rest

let log = 
	Logger.Console
	|> Logger.addConsumer enterpriseConsumer

I want more examples!

Read the source code! It's super simple and documented.

Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  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
6.0.0 209 5/17/2024
5.1.0 3,412 8/8/2021
5.0.0 402 4/10/2021
3.1.27 621 8/12/2019
3.0.26 551 8/12/2019
3.0.25 593 5/31/2019
2.5.24 643 3/8/2019
2.4.22 794 9/25/2018
2.2.16 946 8/25/2017
1.3.11 936 6/15/2017
1.2.10 953 4/24/2017
1.1.7 982 11/22/2016

Added Xplat way to get a long time string