P
Size: a a a
P
P
let myLog =
#if DEBUG
ignore
#else
Printf.kprintf
#endif
P
Dv
VS
AD
let myLog =
#if DEBUG
ignore
#else
Printf.kprintf
#endif
P
let myLog =
if debug then ignore
else Printf.kprintf
P
Dv
let myLog =
if debug then ignore
else Printf.kprintf
NM
P
AD
AD
Dv
logPrintf
Dv
P
let myLog (x : '_a when '_a :> Printf.StringFormat<'_b,unit>) =
#if ! DEBUG
Printf.kprintf (printfn "%s") x
#else
Unchecked.defaultof<_>
#endif
P
myLog "%s sss %i" "aa" 11не чет не так
Dv
open System
let mutable debug = true
let debugLog (format: Printf.StringFormat<'a, unit>): 'a =
Printf.kprintf (
fun s -> if debug then printfn "%A: %s" DateTime.Now s
) format
[<EntryPoint>]
let main _ =
debugLog "This: %s" "foo"
debugLog "That: %d - %d = %d" 2 2 4
debug <- false
debugLog "Invisible! %s" "haha"
debug <- true
debugLog "Visible"
0
NM
open System
let mutable debug = true
let debugLog (format: Printf.StringFormat<'a, unit>): 'a =
Printf.kprintf (
fun s -> if debug then printfn "%A: %s" DateTime.Now s
) format
[<EntryPoint>]
let main _ =
debugLog "This: %s" "foo"
debugLog "That: %d - %d = %d" 2 2 4
debug <- false
debugLog "Invisible! %s" "haha"
debug <- true
debugLog "Visible"
0
NM