package async_unix

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type machine_readable_format = [
  1. | `Sexp
  2. | `Sexp_hum
  3. | `Bin_prot
]
include sig ... end
val machine_readable_format_of_sexp : Sexplib.Sexp.t -> machine_readable_format
val __machine_readable_format_of_sexp__ : Sexplib.Sexp.t -> machine_readable_format
val sexp_of_machine_readable_format : machine_readable_format -> Sexplib.Sexp.t
type format = [
  1. | machine_readable_format
  2. | `Text
]
include sig ... end
val format_of_sexp : Sexplib.Sexp.t -> format
val __format_of_sexp__ : Sexplib.Sexp.t -> format
val sexp_of_format : format -> Sexplib.Sexp.t
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.

The unit Deferred returned by the function should not be fulfilled until the all of the messages in the given queue are completely handled (e.g. written to disk).

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 -> Writer.t -> t
val file : format -> filename:string -> t
val rotating_file : format -> basename:string -> Rotation.t -> t
val rotating_file_with_tail : format -> 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.

OCaml

Innovation. Community. Security.