Library
Module
Module type
Parameter
Class
Class type
Live Logs
val create :
?switch:Lwt_switch.t ->
pending:string ->
branch:string ->
title:string ->
manager ->
t
create ~pending ~branch ~title manager
is a fresh, empty log with pending reason pending
. It is an error to have two live logs on the same branch at the same time (finish the other one first).
val finish : t -> unit
finish t
prevents any further changes and notifies anyone waiting on pending
.
val write : t -> string -> unit
write t msg
appends msg
to the log.
val printf : t -> ('a, Format.formatter, unit, unit) Pervasives.format4 -> 'a
printf t fmt
appends a formatted message to the log.
val log : t -> ('a, Format.formatter, unit, unit) Pervasives.format4 -> 'a
log t fmt
appends a formatted message to the log, with a newline added at the end.
val heading : t -> ('a, Format.formatter, unit, unit) Pervasives.format4 -> 'a
heading t fmt
appends a formatted message to the log as a heading.
with_pending_reason t msg fn
calls fn ()
. If it gets a sleeping thread, then it pushes msg
onto the pending-reason stack, waits for the thread to finish, and then removes the pending message.
val enter_with_pending_reason :
t ->
string ->
(('a -> 'b Lwt.t) -> 'b Lwt.t) ->
('a -> 'b Lwt.t) ->
'b Lwt.t
enter_with_pending_reason t msg use fn
is like use fn
, but posts msg
as the pending reason until fn
is called (or use
fails). This is useful to give a pending reason while getting a mutex or pool resource.
val contents : t -> string
contents t
is the current contents of the buffer.