semantic logging in lib_base
AMENDED: Syn has always been DSL, Semantic has always been Make_semantic.
This commit is contained in:
parent
0bbc18c23b
commit
98961c9335
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -16,19 +16,12 @@ let () =
|
|||||||
Lwt.async_exception_hook :=
|
Lwt.async_exception_hook :=
|
||||||
(function
|
(function
|
||||||
| Exit -> ()
|
| Exit -> ()
|
||||||
| exn ->
|
| e ->
|
||||||
let backtrace = Printexc.get_backtrace () in
|
let backtrace = Printexc.get_backtrace () in
|
||||||
Base_logging.fatal_error "@[<v 2>%a%a@]"
|
Base_logging.(fatal_error Tag.DSL.(fun f ->
|
||||||
(fun ppf exn ->
|
f "@[<v 2>@[Uncaught (asynchronous) exception (%d):@ %a@]%a@]"
|
||||||
Format.fprintf ppf
|
-% t event "uncaught_async_exception"
|
||||||
"@[Uncaught (asynchronous) exception (%d):@ %a@]"
|
-% s pid (Unix.getpid ())
|
||||||
(Unix.getpid ())
|
-% a exn e
|
||||||
Error_monad.pp_exn exn)
|
-% a exn_trace backtrace)) ;
|
||||||
exn
|
|
||||||
(fun ppf backtrace ->
|
|
||||||
if String.length backtrace <> 0 then
|
|
||||||
Format.fprintf ppf
|
|
||||||
"@,Backtrace:@, @[<h>%a@]"
|
|
||||||
Format.pp_print_text backtrace)
|
|
||||||
backtrace ;
|
|
||||||
Lwt.wakeup exit_wakener 1)
|
Lwt.wakeup exit_wakener 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user