Created
March 29, 2020 21:19
-
-
Save rizo/fc6cef5525c2218a61ab5af5a84755c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type 'a printer = Format.formatter -> 'a -> unit | |
let inspect (pp : 'a printer) = | |
Format.(kfprintf (fun f -> pp_print_newline f ()) std_formatter "%a" pp) | |
let print ?(channel=stdout) fmt = | |
let f = Format.formatter_of_out_channel channel in | |
Format.(kfprintf (fun f -> pp_print_newline f ()) f fmt) | |
let debug fmt = print ~channel:stderr ("[DEBUG] " ^^ fmt) | |
let error fmt = print ~channel:stderr ("[ERROR] " ^^ fmt) | |
let info fmt = print ~channel:stderr ("[INFO] " ^^ fmt) | |
let warning fmt = print ~channel:stderr ("[WARNING] " ^^ fmt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment