package asl

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module AslSource

Allow an application to log via the Apple System Log

The Apple System Log is intended to be a replacement for syslog on OSX systems.

Example:

  let client = Asl.Client.create ~ident:"example" ~facility:"Daemon" ~opts:[ `Stderr ] () in
  let message = Asl.Message.create ~sender:"example" () in
  Asl.log ~client message `Notice "hello, world!"

For context, please read the following documents:

  1. Apple System Log man pages
Sourcetype level = [
  1. | `Emerg
    (*

    most severe, highest level

    *)
  2. | `Alert
  3. | `Crit
  4. | `Err
  5. | `Warning
  6. | `Notice
  7. | `Info
  8. | `Debug
    (*

    least severe, lowest level

    *)
]

Every message has an associated level, which is usually used for filtering.

Sourcemodule Client : sig ... end
Sourcemodule Message : sig ... end
Sourceval log : ?client:Client.t -> Message.t -> level -> string -> unit

Send a string to the logger with the given message context and level.

Creating a client is optional. If none is provided then a default thread-safe client is used. Note the internal locks can cause extra contention between threads. Note also the only way to have logs printed to stderr is to construct and use a Client.t.