Up

Module Log

Signature

include Async.Std.Log
module Level : sig .. end
module Message : sig .. end
module Rotation : sig .. end
module Output : sig .. end
module Blocking : sig .. end
type t
val sexp_of_t : t -> Sexplib.Sexp.t
module type Global_intf = sig .. end
An interface for singleton logs
This functor can be called to generate "singleton" logging modules
Programs that want simplistic single-channel logging can open this module.
val set_level : t -> Level.t -> unit

messages sent at a level less than the current level will not be output.

val level : t -> Level.t

returns the last level passed to set_level, which will be the log level checked as a threshold against the level of the next message sent.

val set_output : t -> Output.t list -> unit

changes the output type of the log, which can be useful when daemonizing. The new output type will be applied to all subsequent messages.

val get_output : t -> Output.t list
val set_on_error : t -> [
| `Raise
| `Call of Core.Std.Error.t -> unit
] -> unit

if `Raise is given then background errors raised by logging will be raised to the monitor that was in scope when create was called. Errors can be redirected anywhere by providing `Call f.

val close : t -> unit

any call that writes to a log after close is called will raise.

val is_closed : t -> bool

returns true if close has been called

val flushed : t -> unit Async_unix.Import.Deferred.t

returns a Deferred.t that is fulfilled when the last message delivered to t before the call to flushed is out the door.

val rotate : t -> unit Async_unix.Import.Deferred.t

informs the current Outputs to rotate if possible

val create : level:Level.t -> output:Output.t list -> on_error:[
| `Raise
| `Call of Core.Std.Error.t -> unit
] -> t

create a new log. See set_level, set_on_error and set_output for more.

val raw : ?time:Core.Std.Time.t -> ?tags:(string * string) list -> t -> ('a, unit, string, unit) Core.Std.format4 -> 'a

raw printf like logging for raw (no level) messages. Raw messages are still output with a timestamp.

val debug : ?time:Core.Std.Time.t -> ?tags:(string * string) list -> t -> ('a, unit, string, unit) Core.Std.format4 -> 'a

debug printf like logging at the `Debug log level

val info : ?time:Core.Std.Time.t -> ?tags:(string * string) list -> t -> ('a, unit, string, unit) Core.Std.format4 -> 'a

info printf like logging at the `Info log level

val error : ?time:Core.Std.Time.t -> ?tags:(string * string) list -> t -> ('a, unit, string, unit) Core.Std.format4 -> 'a

error printf like logging at the `Error log level

val printf : ?level:Level.t -> ?time:Core.Std.Time.t -> ?tags:(string * string) list -> t -> ('a, unit, string, unit) Core.Std.format4 -> 'a

printf generalized printf style logging

val sexp : ?level:Level.t -> ?time:Core.Std.Time.t -> ?tags:(string * string) list -> t -> 'a -> ('a -> Core.Std.Sexp.t) -> unit

sexp logging of values without first converting them to a string. In the case where the log level would discard this message no string conversion will ever be done.

val string : ?level:Level.t -> ?time:Core.Std.Time.t -> ?tags:(string * string) list -> t -> string -> unit

string logging of string values

val message : t -> Message.t -> unit

message log a preexisting message

module Reader : sig .. end
include Extended_log
module Console : sig .. end
module Syslog : sig .. end