Skip to content

Commit

Permalink
Improve docs of Lwt_log
Browse files Browse the repository at this point in the history
- Be clearer about relation with Lwt_log_core.
- Provide a usage example.
- Recommend using Logs_lwt from logs library.

Resolves #468.

[skip ci]
  • Loading branch information
aantron committed Oct 13, 2017
1 parent 860d5d9 commit af91fad
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions src/unix/lwt_log.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,38 @@
* 02111-1307, USA.
*)

(** Logging facility *)

(** This module provides functions to deal with logging.
It extends {!Lwt_log_core} with Unix features.
It adds:
- logging to the syslog daemon
- logging to a channel (stderr, stdout, ...)
- logging to a file
*)
(** Logging functions
This module provides logging functions. It is actually a thin extension of
{!Lwt_log_core}, adding logging destinations that are only available on Unix
and Windows (such as files, standard output, and the system log). Being a
thin extension, most of the functions in this module are actually the ones
in {!Lwt_log_core}. They are not repeated on this page, however, so please
read both {!Lwt_log_core} {e and} this page for a complete understanding.
Here is a simple, self-contained usage example:
{[
let () =
Lwt_log.default :=
Lwt_log.channel
~template:"$(date).$(milliseconds) [$(level)] $(message)"
~close_mode:`Keep
~channel:Lwt_io.stdout
();
Lwt_log.add_rule "*" Lwt_log.Info;
Lwt_main.run begin
Lwt_log.info "Hello world!"
end
(* ocamlfind opt -linkpkg -package lwt.unix log_example.ml && ./a.out *)
]}
As an alternative to this module, we suggest trying
{{: http://erratique.ch/software/logs/doc/Logs_lwt.html}[Logs_lwt] from the
{{: http://erratique.ch/software/logs} [logs]} library. *)

include module type of Lwt_log_core
with type level = Lwt_log_core.level
Expand Down

0 comments on commit af91fad

Please sign in to comment.