mirror of
https://github.com/c-cube/linol.git
synced 2025-12-06 03:05:31 -05:00
more debug
This commit is contained in:
parent
78bb184117
commit
c0530ee57d
1 changed files with 13 additions and 3 deletions
|
|
@ -32,12 +32,22 @@ let catch f g =
|
||||||
try f()
|
try f()
|
||||||
with e -> g e
|
with e -> g e
|
||||||
|
|
||||||
|
let spf = Printf.sprintf
|
||||||
|
|
||||||
let rec read ic buf i len =
|
let rec read ic buf i len =
|
||||||
if len>0 then (
|
if len>0 then (
|
||||||
let n = input ic buf i len in
|
let n = input ic buf i len in
|
||||||
read ic buf (i+n) (len-n)
|
read ic buf (i+n) (len-n)
|
||||||
)
|
)
|
||||||
|
|
||||||
let read_line = input_line
|
let read_line ic =
|
||||||
let write oc b i len = output oc b i len; flush oc
|
let s = input_line ic in
|
||||||
let write_string oc s = output_string oc s; flush oc
|
!Jsonrpc2._log (fun () -> spf "read line: '%s'" s);
|
||||||
|
s
|
||||||
|
|
||||||
|
let write oc b i len =
|
||||||
|
!Jsonrpc2._log (fun () -> spf "write '%s'[%d..%d]" (Bytes.unsafe_to_string b) i (i+len));
|
||||||
|
output oc b i len; flush oc
|
||||||
|
let write_string oc s =
|
||||||
|
!Jsonrpc2._log (fun () -> spf "write-str '%s'" s);
|
||||||
|
output_string oc s; flush oc
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue