aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar Enrico Tassi <Enrico.Tassi@inria.fr>2016-09-13 09:35:05 +0200
committerGravatar Enrico Tassi <Enrico.Tassi@inria.fr>2016-09-13 12:58:07 +0200
commita5fb20b4ad4a56e15455ca329fbc4d03ac5fe072 (patch)
tree3ae3a5d90a6bee3189e21b23c53954b1d2599314 /lib
parent6234ecf5f5752768175d510749cc48a97c2c0dbe (diff)
feedback: provide a feeder that prints debug messages
Diffstat (limited to 'lib')
-rw-r--r--lib/feedback.ml5
-rw-r--r--lib/feedback.mli3
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/feedback.ml b/lib/feedback.ml
index 4bda936f2..dd1ca2af3 100644
--- a/lib/feedback.ml
+++ b/lib/feedback.ml
@@ -128,6 +128,11 @@ let msg_debug ?loc x = !logger ?loc Debug x
let feeders = ref []
let add_feeder f = feeders := f :: !feeders
+let debug_feeder = function
+ | { contents = Message (Debug, loc, pp) } ->
+ msg_debug ?loc (Pp.str (Richpp.raw_print pp))
+ | _ -> ()
+
let feedback_id = ref (Edit 0)
let feedback_route = ref default_route
diff --git a/lib/feedback.mli b/lib/feedback.mli
index d19517bb9..48b1c19a6 100644
--- a/lib/feedback.mli
+++ b/lib/feedback.mli
@@ -86,6 +86,9 @@ val emacs_logger : logger
(** [add_feeder] feeders observe the feedback *)
val add_feeder : (feedback -> unit) -> unit
+(** Prints feedback messages of kind Message(Debug,_) using msg_debug *)
+val debug_feeder : feedback -> unit
+
(** [feedback ?id ?route fb] produces feedback fb, with [route] and
[id] set appropiatedly, if absent, it will use the defaults set by
[set_id_for_feedback] *)