mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-08 03:47:57 -04:00
compat OCaml 4.12
This commit is contained in:
parent
71dc18c00a
commit
cdab1c0956
1 changed files with 5 additions and 2 deletions
|
|
@ -6,6 +6,9 @@ module A = Trace_core.Internal_.Atomic_
|
||||||
|
|
||||||
let on_tracing_error = ref (fun s -> Printf.eprintf "trace-tef error: %s\n%!" s)
|
let on_tracing_error = ref (fun s -> Printf.eprintf "trace-tef error: %s\n%!" s)
|
||||||
|
|
||||||
|
let[@inline] int64_of_trace_id_ (id : Trace_core.trace_id) : int64 =
|
||||||
|
Bytes.get_int64_le (Bytes.unsafe_of_string id) 0
|
||||||
|
|
||||||
module Mock_ = struct
|
module Mock_ = struct
|
||||||
let enabled = ref false
|
let enabled = ref false
|
||||||
let now = ref 0
|
let now = ref 0
|
||||||
|
|
@ -147,7 +150,7 @@ module Writer = struct
|
||||||
emit_sep_and_start_ self;
|
emit_sep_and_start_ self;
|
||||||
Printf.bprintf self.buf
|
Printf.bprintf self.buf
|
||||||
{json|{"pid":%d,"cat":"trace","id":%Ld,"tid": %d,"ts": %.2f,"name":%a,"ph":"%c"%a}|json}
|
{json|{"pid":%d,"cat":"trace","id":%Ld,"tid": %d,"ts": %.2f,"name":%a,"ph":"%c"%a}|json}
|
||||||
self.pid (String.get_int64_le id 0) tid ts str_val name
|
self.pid (int64_of_trace_id_ id) tid ts str_val name
|
||||||
(match flavor with
|
(match flavor with
|
||||||
| None | Some Async -> 'b'
|
| None | Some Async -> 'b'
|
||||||
| Some Sync -> 'B')
|
| Some Sync -> 'B')
|
||||||
|
|
@ -160,7 +163,7 @@ module Writer = struct
|
||||||
emit_sep_and_start_ self;
|
emit_sep_and_start_ self;
|
||||||
Printf.bprintf self.buf
|
Printf.bprintf self.buf
|
||||||
{json|{"pid":%d,"cat":"trace","id":%Ld,"tid": %d,"ts": %.2f,"name":%a,"ph":"%c"%a}|json}
|
{json|{"pid":%d,"cat":"trace","id":%Ld,"tid": %d,"ts": %.2f,"name":%a,"ph":"%c"%a}|json}
|
||||||
self.pid (String.get_int64_le id 0) tid ts str_val name
|
self.pid (int64_of_trace_id_ id) tid ts str_val name
|
||||||
(match flavor with
|
(match flavor with
|
||||||
| None | Some Async -> 'e'
|
| None | Some Async -> 'e'
|
||||||
| Some Sync -> 'E')
|
| Some Sync -> 'E')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue