mirror of
https://github.com/c-cube/linol.git
synced 2025-12-06 03:05:31 -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 () =
|
||||
try f()
|
||||
with e ->
|
||||
Printf.eprintf "linol: uncaught exception in `spawn`:\n%s\n%!"
|
||||
(Printexc.to_string e);
|
||||
let msg =
|
||||
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
|
||||
in
|
||||
ignore (Thread.create run () : Thread.t)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ type json = Yojson.Safe.t
|
|||
|
||||
module type IO = Sigs.IO
|
||||
|
||||
let _log : ((unit -> string) -> unit) ref = ref (fun _ -> ())
|
||||
|
||||
module type S = sig
|
||||
module IO : IO
|
||||
|
||||
|
|
|
|||
|
|
@ -30,3 +30,7 @@ module type S = sig
|
|||
end
|
||||
|
||||
module Make(IO : IO) : S with module IO = IO
|
||||
|
||||
(**/**)
|
||||
val _log : ((unit -> string) -> unit) ref
|
||||
(**/**)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue