2020-06-12 15:33:14 +04:00
|
|
|
open Display
|
|
|
|
|
|
|
|
let ppx_ppformat ~display_format f (buf,_) =
|
|
|
|
match display_format with
|
2020-06-12 15:34:08 +04:00
|
|
|
| Human_readable | Dev -> Format.fprintf f "%s" (Buffer.contents buf)
|
2020-06-12 15:33:14 +04:00
|
|
|
|
|
|
|
let ppx_jsonformat (buf,_) : json =
|
|
|
|
let s = Format.asprintf "%s" (Buffer.contents buf) in
|
|
|
|
`String s
|
|
|
|
|
|
|
|
let ppx_format : 'a format = {
|
|
|
|
pp = ppx_ppformat;
|
|
|
|
to_json = ppx_jsonformat;
|
|
|
|
}
|