[reporting] add float support to JsonBuilder

Summary:
- Add support for floating point values to JsonBuilder
- This allows EventLogger to log fields of type float

Reviewed By: dulmarod

Differential Revision: D7138542

fbshipit-source-id: 8a4e353
master
Varun Arora 7 years ago committed by Facebook Github Bot
parent eef8774aa2
commit fa3bd1e140

@ -13,12 +13,14 @@ type t = (string * Yojson.Basic.json) list
let empty = []
let add_int t ~key ~data = (key, `Int data) :: t
let _add_float t ~key ~data = (key, `Float data) :: t
let add_string t ~key ~data = (key, `String data) :: t
let add_string_opt t ~key ~data =
match data with Some data -> add_string t ~key ~data | None -> t
let add_int t ~key ~data = (key, `Int data) :: t
let to_json t = Yojson.Basic.to_string (`Assoc t)

@ -11,10 +11,10 @@ type t
val empty : t
val add_int : t -> key:string -> data:int -> t
val add_string : t -> key:string -> data:string -> t
val add_string_opt : t -> key:string -> data:string option -> t
val add_int : t -> key:string -> data:int -> t
val to_json : t -> string

Loading…
Cancel
Save