type log_tag = [ `Debug | `Error | `Message | `Warning ]
type log_callback = log_tag -> string -> unit
+(*
+colors=(black red green yellow blue magenta cyan gray white)
+ccodes=(30 31 32 33 34 35 36 37 39)
+*)
+
+let green = "\e[01;32m"
+let blue = "\e[01;34m"
+let yellow = "\e[01;33m"
+let red = "\e[01;31m"
+let black = "\e[0;0m"
+
let default_callback tag s =
let prefix =
match tag with
- | `Message -> "Info: "
- | `Warning -> "Warning: "
- | `Error -> "Error: "
- | `Debug -> "Debug: "
+ | `Message -> green ^ "Info: "
+ | `Warning -> yellow ^ "Warn: "
+ | `Error -> red ^ "Error: "
+ | `Debug -> blue ^ "Debug: "
in
- print_endline (prefix ^ s);
+ print_endline (prefix ^ black ^ s);
flush stdout
let callback = ref default_callback