semantic logging in lib_base

AMENDED: Syn has always been DSL, Semantic has always been
Make_semantic.
This commit is contained in:
James Deikun 2018-06-11 15:05:33 -04:00
parent 0bbc18c23b
commit 98961c9335
3 changed files with 21 additions and 16 deletions

View File

@ -7,4 +7,13 @@
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.Make(struct let name = "base" end)
include Tezos_stdlib.Logging.Make_semantic(struct let name = "base" end)
let pp_exn_trace ppf backtrace =
if String.length backtrace <> 0 then
Format.fprintf ppf
"@,Backtrace:@, @[<h>%a@]"
Format.pp_print_text backtrace
let pid = Tag.def ~doc:"unix process ID where problem occurred" "pid" Format.pp_print_int
let exn_trace = Tag.def ~doc:"backtrace from native Ocaml exception" "exn_trace" pp_exn_trace

View File

@ -7,4 +7,7 @@
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.LOG
include Tezos_stdlib.Logging.SEMLOG
val pid : int Tag.def
val exn_trace : string Tag.def

View File

@ -16,19 +16,12 @@ let () =
Lwt.async_exception_hook :=
(function
| Exit -> ()
| exn ->
| e ->
let backtrace = Printexc.get_backtrace () in
Base_logging.fatal_error "@[<v 2>%a%a@]"
(fun ppf exn ->
Format.fprintf ppf
"@[Uncaught (asynchronous) exception (%d):@ %a@]"
(Unix.getpid ())
Error_monad.pp_exn exn)
exn
(fun ppf backtrace ->
if String.length backtrace <> 0 then
Format.fprintf ppf
"@,Backtrace:@, @[<h>%a@]"
Format.pp_print_text backtrace)
backtrace ;
Base_logging.(fatal_error Tag.DSL.(fun f ->
f "@[<v 2>@[Uncaught (asynchronous) exception (%d):@ %a@]%a@]"
-% t event "uncaught_async_exception"
-% s pid (Unix.getpid ())
-% a exn e
-% a exn_trace backtrace)) ;
Lwt.wakeup exit_wakener 1)