How do I create an F# function with a printf style logging argument?
问题 I'm trying to create a framework to do some processing of files and data. The one area I'm struggling with is how to provide a logging function to the framework, allowing the framework to report messages without having any knowledge of the logging in use. let testLogger (source:seq<'a>) logger = logger "Testing..." let length = source |> Seq.length logger "Got a length of %d" length let logger format = Printf.kprintf (printfn "%A: %s" System.DateTime.Now) format testLogger [1; 2; 3] logger