Cmdliner terms for ergonomic logging configuration
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): replace Printf/Format with Fmt across remaining packages

Migrate Printf.sprintf to Fmt.str, Format.fprintf to Fmt.pf, and
Format.pp_print_string to Fmt.string across bundle, gpt, hap, homebrew,
jsonwt, matter, mbr, meross, paseto, precommit, publicsuffix, qemu,
retry, sdnv, slack, sle, space-packet, spake2, sqlite, squashfs, tar,
tc, tcf, tcpcl, tm, tomlt, tty, uslp, vlog, wal, wire, yamlrw, yamlt,
osrelease, space, xdge, and crypto test runner.

+4 -6
+4 -6
lib/vlog.ml
··· 140 140 | Logs.Info -> "info" 141 141 | Logs.Debug -> "debug" 142 142 in 143 - Format.fprintf ppf 144 - {|{"ts":"%s","src":"%s","level":"%s","msg":"%s"}@.|} ts name 145 - level_s (String.escaped msg); 143 + Fmt.pf ppf {|{"ts":"%s","src":"%s","level":"%s","msg":"%s"}@.|} ts 144 + name level_s (String.escaped msg); 146 145 k ()) 147 146 (Format.formatter_of_buffer buf) 148 147 fmt ··· 162 161 let env = 163 162 Cmd.Env.info env_name 164 163 ~doc: 165 - (Printf.sprintf 164 + (Fmt.str 166 165 "Log configuration for %s. Format: LEVEL[,SRC:LEVEL,...]. Example: \ 167 166 debug,tls.tracing:warning" 168 167 app_name) ··· 187 186 let parse_tag s = 188 187 match String.index_opt s '=' with 189 188 | None -> 190 - Error 191 - (`Msg (Printf.sprintf "Invalid tag format '%s', expected KEY=VALUE" s)) 189 + Error (`Msg (Fmt.str "Invalid tag format '%s', expected KEY=VALUE" s)) 192 190 | Some i -> 193 191 let key = String.sub s 0 i in 194 192 let value = String.sub s (i + 1) (String.length s - i - 1) in