An rich, simple, and efficient micro logging library for F#.
This isn't frequently updated because it's literally perfect (well, probably, almost).
This is used in several production systems. It's great. It's perfect, and you should use it!
f Yes and you should use it.
Yes, as of 2024 - we're just mostly feature complete here. How complicated could logging be anyway?
You can install it via NuGet. You should already know how to do that. This runs on .NET Core, 6.0, 7.0, 8.0, etc. Go forth and use it.
let smartDevCount = 5
let devCount = 5
open FSLogger
let log = Logger.ColorConsole
log.I "Uzing da librariez" // log to info
let descr = "best"
log.N $"This is the ${descr} library" // log to notice using 5.0-style interpolation
Okay fine. The library can do a bunch of stuff.
Also has some nice colour output by default.
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, {aNumber} is bigger than 5!"
// do something important
ignore aNumber
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