mirror of
https://github.com/c-cube/linol.git
synced 2025-12-06 11:15:46 -05:00
add some basic logging
This commit is contained in:
parent
b2e2259f35
commit
78bb184117
3 changed files with 12 additions and 2 deletions
|
|
@ -18,8 +18,12 @@ let spawn f =
|
||||||
let run () =
|
let run () =
|
||||||
try f()
|
try f()
|
||||||
with e ->
|
with e ->
|
||||||
Printf.eprintf "linol: uncaught exception in `spawn`:\n%s\n%!"
|
let msg =
|
||||||
(Printexc.to_string e);
|
Printf.sprintf "linol: uncaught exception in `spawn`:\n%s\n%!"
|
||||||
|
(Printexc.to_string e)
|
||||||
|
in
|
||||||
|
!Jsonrpc2._log (fun () -> msg);
|
||||||
|
Printf.eprintf "%s\n%!" msg;
|
||||||
raise e
|
raise e
|
||||||
in
|
in
|
||||||
ignore (Thread.create run () : Thread.t)
|
ignore (Thread.create run () : Thread.t)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ type json = Yojson.Safe.t
|
||||||
|
|
||||||
module type IO = Sigs.IO
|
module type IO = Sigs.IO
|
||||||
|
|
||||||
|
let _log : ((unit -> string) -> unit) ref = ref (fun _ -> ())
|
||||||
|
|
||||||
module type S = sig
|
module type S = sig
|
||||||
module IO : IO
|
module IO : IO
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,3 +30,7 @@ module type S = sig
|
||||||
end
|
end
|
||||||
|
|
||||||
module Make(IO : IO) : S with module IO = IO
|
module Make(IO : IO) : S with module IO = IO
|
||||||
|
|
||||||
|
(**/**)
|
||||||
|
val _log : ((unit -> string) -> unit) ref
|
||||||
|
(**/**)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue