-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
include LoggerSigs | ||
|
||
type 'a Effect.t += | ||
| Debug : Diagnostic.loctext -> unit Effect.t | ||
| CallBegin : Diagnostic.loctext -> unit Effect.t | ||
| CallEnd : Diagnostic.loctext -> unit Effect.t | ||
|
||
let debug_loctext t = Effect.perform @@ Debug t | ||
let debug ?loc s = debug_loctext @@ Diagnostic.loctext ?loc s | ||
let debugf ?loc = Diagnostic.kloctextf ?loc debug_loctext | ||
|
||
let stalk_open_loctext t = Effect.perform @@ CallBegin t | ||
let stalk_close_loctext t = Effect.perform @@ CallEnd t | ||
let stalk ?loc s f = | ||
stalk_open_loctext (Diagnostic.loctext ?loc s); | ||
Fun.protect f | ||
~finally:(fun () -> stalk_close_loctext (Diagnostic.loctext ?loc s)) | ||
let stalkf ?loc = | ||
Diagnostic.ktextf @@ fun t f -> | ||
stalk_open_loctext {Range.value = t; loc}; | ||
Fun.protect f | ||
~finally:(fun () -> stalk_close_loctext {Range.value = t; loc}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include module type of LoggerSigs | ||
|
||
module Make () : S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module type S = | ||
sig | ||
val debug : ?loc:Range.t -> string -> unit | ||
val debugf : ?loc:Range.t -> ('a, Format.formatter, unit, unit) format4 -> 'a | ||
val stalk : ?loc:Range.t -> string -> (unit -> 'a) -> 'a | ||
val stalkf : ?loc:Range.t -> ('b, Format.formatter, unit, (unit -> 'a) -> 'a) format4 -> 'b | ||
end |