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.)