|
| 1 | +(* Js_of_ocaml library |
| 2 | + * http://www.ocsigen.org/js_of_ocaml/ |
| 3 | + * Copyright (C) 2014 Hugo Heuzard |
| 4 | + * |
| 5 | + * This program is free software; you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU Lesser General Public License as published by |
| 7 | + * the Free Software Foundation, with linking exception; |
| 8 | + * either version 2.1 of the License, or (at your option) any later version. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU Lesser General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU Lesser General Public License |
| 16 | + * along with this program; if not, write to the Free Software |
| 17 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | + *) |
| 19 | + |
| 20 | + |
| 21 | +include module type of Lwt_log_core |
| 22 | + with type level = Lwt_log_core.level |
| 23 | + and type logger = Lwt_log_core.logger |
| 24 | + and type section = Lwt_log_core.section |
| 25 | + and type template = Lwt_log_core.template |
| 26 | + and module Section = Lwt_log_core.Section |
| 27 | + |
| 28 | +(** Lwt logger for js_of_ocaml *) |
| 29 | + |
| 30 | +(** {2 Predefined logger} *) |
| 31 | + |
| 32 | +val console : Lwt_log.logger |
| 33 | +(** Logger that use the javascript console object. *) |
| 34 | + |
| 35 | + |
| 36 | +(** {2 Logging functions} *) |
| 37 | + |
| 38 | +val log : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> level : level -> string -> unit Lwt.t |
| 39 | + (** [log ?section ?logger ~level message] logs a message. |
| 40 | +
|
| 41 | + [section] defaults to {!Section.main}. If [logger] is not |
| 42 | + specified, then the default one is used instead (see |
| 43 | + {!default}). |
| 44 | +
|
| 45 | + If [exn] is provided, then its string representation |
| 46 | + (= [Printexc.to_string exn]) will be append to the message, and if |
| 47 | + possible the backtrace will also be logged. |
| 48 | +
|
| 49 | + If [inspect] is provided, it will be append to the message. |
| 50 | +
|
| 51 | + [location] contains the location of the logging directive, it is |
| 52 | + of the form [(file_name, line, column)]. *) |
| 53 | + |
| 54 | +val log_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> level : level -> ('a, unit, string, unit Lwt.t) format4 -> 'a |
| 55 | + (** [log_f] is the same as [log] except that it takes a format |
| 56 | + string *) |
| 57 | + |
| 58 | +val ign_log : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> level : level -> string -> unit |
| 59 | + (** Same as {!log} but ignore the resulting thread. *) |
| 60 | + |
| 61 | +val ign_log_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> level : level -> ('a, unit, string, unit) format4 -> 'a |
| 62 | + (** Same as {!log_f} but ignore the resulting thread. *) |
| 63 | + |
| 64 | +(** The following functions are the same as {!log} except that their |
| 65 | + name determines which level is used. |
| 66 | +
|
| 67 | + For example {!info msg} is the same as {!log ~level:Info msg}. |
| 68 | +*) |
| 69 | + |
| 70 | +val debug : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit Lwt.t |
| 71 | +val debug_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a |
| 72 | +val ign_debug : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit |
| 73 | +val ign_debug_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit) format4 -> 'a |
| 74 | + |
| 75 | +val info : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit Lwt.t |
| 76 | +val info_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a |
| 77 | +val ign_info : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit |
| 78 | +val ign_info_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit) format4 -> 'a |
| 79 | + |
| 80 | +val notice : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit Lwt.t |
| 81 | +val notice_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a |
| 82 | +val ign_notice : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit |
| 83 | +val ign_notice_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit) format4 -> 'a |
| 84 | + |
| 85 | +val warning : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit Lwt.t |
| 86 | +val warning_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a |
| 87 | +val ign_warning : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit |
| 88 | +val ign_warning_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit) format4 -> 'a |
| 89 | + |
| 90 | +val error : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit Lwt.t |
| 91 | +val error_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a |
| 92 | +val ign_error : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit |
| 93 | +val ign_error_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit) format4 -> 'a |
| 94 | + |
| 95 | +val fatal : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit Lwt.t |
| 96 | +val fatal_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit Lwt.t) format4 -> 'a |
| 97 | +val ign_fatal : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> string -> unit |
| 98 | +val ign_fatal_f : ?inspect : 'v -> ?exn : exn -> ?section : section -> ?location : (string * int * int) -> ?logger : logger -> ('a, unit, string, unit) format4 -> 'a |
0 commit comments