Module Async_unix__.Log.Output

module Format : sig ... end
type t
val create : ?⁠rotate:(unit ‑> unit Async_unix__.Import.Deferred.t) ‑> ?⁠close:(unit ‑> unit Async_unix__.Import.Deferred.t) ‑> flush:(unit ‑> unit Async_unix__.Import.Deferred.t) ‑> (Message.t Core.Queue.t ‑> unit Async_unix__.Import.Deferred.t) ‑> t

create f returns a t, given a function that actually performs the final output work. It is the responsibility of the write function to contain all state, and to clean up after itself when it is garbage collected (which may require a finalizer). The function should avoid modifying the contents of the queue; it's reused for each Output.t.

The "stock" output modules support a sexp and bin_prot output format, and other output modules should make efforts to support them as well where it is meaningful/appropriate to do so.

flush should return a deferred that is fulfilled only when all previously written messages are durable (e.g., on disk, out on the network, etc.). It is automatically called on shutdown by Log, but isn't automatically called at any other time. It can be called manually by calling Log.flushed t.

The unit Deferred returned by the function provides an opportunity for pushback if that is important. Only one batch of messages will be "in flight" at any time based on this deferred.

An optional rotate function may be given which will be called when Log.rotate t is called while this output is in effect. This is useful for programs that want very precise control over rotation.

If close is provided it will be called when the log falls out of scope. (Note that it is not called directly, even if you close a log which is using this output, because outputs are sometimes reused.)

val stdout : unit ‑> t
val stderr : unit ‑> t
val writer : Format.t ‑> Async_unix.Writer.t ‑> t
val file : Format.t ‑> filename:string ‑> t
val rotating_file : Format.t ‑> basename:string ‑> Rotation.t ‑> t
val rotating_file_with_tail : Format.t ‑> basename:string ‑> Rotation.t ‑> t * string Async_unix__.Import.Tail.t

Returns a tail of the filenames. When rotate is called, the previous filename is put on the tail

See Async_extended.Std.Log for syslog and colorized console output.