Skip to content

Commit

Permalink
do not depend on moonpool.fib in core
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Mar 21, 2024
1 parent 4c29909 commit 9f2177d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/core/log_ctx.ml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module FLS = Moonpool_fib.Fls
module LS = Moonpool.Task_local_storage

type 'a tag = 'a Logs.Tag.def

(** Storage key for the ambient context. *)
let ctx_k : Logs.Tag.t Str_map.t FLS.key =
FLS.new_key ~init:(fun () -> Str_map.empty) ()
let ctx_k : Logs.Tag.t Str_map.t LS.key =
LS.new_key ~init:(fun () -> Str_map.empty) ()

let create_tag ?doc name pp : _ tag = Logs.Tag.def ?doc name pp

let get_tags_from_ctx () : Logs.Tag.set =
match FLS.get ctx_k with
match LS.get ctx_k with
| exception Failure _ -> Logs.Tag.empty
| map ->
(* build the current set of tags *)
Expand All @@ -18,10 +18,10 @@ let get_tags_from_ctx () : Logs.Tag.set =
map Logs.Tag.empty

let with_tag (tag : _ tag) v (f : unit -> 'b) : 'b =
match FLS.get ctx_k with
match LS.get ctx_k with
| exception Failure _ -> f ()
| old_map ->
let new_map =
Str_map.add (Logs.Tag.name tag) (Logs.Tag.V (tag, v)) old_map
in
FLS.with_value ctx_k new_map f
LS.with_value ctx_k new_map f
1 change: 0 additions & 1 deletion src/thread/dune
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
containers
threads.posix
moonpool
moonpool.fib
imandrakit
hmap
ptime
Expand Down

0 comments on commit 9f2177d

Please sign in to comment.