Module Log


module Log: sig .. end
Logging Services for Frama-C Kernel and Plugins.
Since Beryllium-20090601-beta1


type kind =
| Result
| Feedback
| Debug
| Warning
| Error
| Failure

type source = {
   src_file : string;
   src_line : int;
}
Since Beryllium-20090601-beta1

type event = {
   evt_kind : kind;
   evt_plugin : string;
   evt_source : source option;
   evt_message : string;
}
Since Beryllium-20090601-beta1
type 'a pretty_printer = ?current:bool ->
?source:source ->
?emitwith:(event -> unit) ->
?echo:bool ->
?once:bool ->
?append:(Format.formatter -> unit) ->
('a, Format.formatter, unit) Pervasives.format -> 'a
Since Beryllium-20090601-beta1
type ('a, 'b) pretty_aborter = ?current:bool ->
?source:source ->
?echo:bool ->
?append:(Format.formatter -> unit) ->
('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
Since Beryllium-20090601-beta1

Exception Registry


exception AbortError of string
Plug-in name

User error that prevents a plugin to terminate.
exception AbortFatal of string
Plug-in name

Internal error that prevents a plugin to terminate.
exception FeatureRequest of string * string
Raise by not_yet_implemented. You may catch FeatureRequest(p,r) to support degenerated behavior. The responsible plugin is 'p' and the feature request is 'r'.

Plugin Interface


module type Messages = sig .. end
module Register: 
functor (P : sig
val channel : string
val label : string
val verbose_atleast : int -> bool
val debug_atleast : int -> bool
end) -> Messages
Each plugin has its own channel to output messages.

Echo and Notification


val set_echo : ?plugin:string -> ?kind:kind list -> bool -> unit
Turns echo on or off. Applies to all channel unless specified, and all kind of messages unless specified.
Since Beryllium-20090601-beta1
val add_listener : ?plugin:string -> ?kind:kind list -> (event -> unit) -> unit
Register a hook that is called each time an event is emitted. Applies to all channel unless specified, and all kind of messages unless specified.
Since Beryllium-20090601-beta1
val echo : event -> unit
Display an event of the terminal, unless echo has been turned off.
Since Beryllium-20090601-beta1
val notify : event -> unit
Send an event over the associated listeners.
Since Beryllium-20090601-beta1
val reset_once_flag : unit -> unit
Reset the once flag of pretty-printers. Messages already printed will be printed again.
Since Boron-20100401

Channel interface

This is the low-level interface to logging services. Not to be used by casual users.
type channel 
Since Beryllium-20090601-beta1
val new_channel : string -> channel
Since Beryllium-20090901

type prefix =
| Label of string
| Prefix of string
| Indent of int
val log_channel : channel -> ?kind:kind -> ?prefix:prefix -> 'a pretty_printer
logging function to user-created channel.
Since Beryllium-20090901
val with_log_channel : channel ->
(event -> 'a) ->
?kind:kind -> ?prefix:prefix -> ('b, 'a) pretty_aborter
logging function to user-created channel.
Since Beryllium-20090901
val kernel_channel_name : string
the reserved channel name used by the Frama-C kernel.
Since Beryllium-20090601-beta1
val kernel_label_name : string
the reserved label name used by the Frama-C kernel.
Since Beryllium-20090601-beta1
val set_current_source : (unit -> source) -> unit
Since Beryllium-20090601-beta1

Terminal interface

This is the low-level interface to logging services. Not to be used by casual users.
val null : Format.formatter
Prints nothing.
Since Beryllium-20090901
val nullprintf : ('a, Format.formatter, unit) Pervasives.format -> 'a
Discards the message and returns unit.
Since Beryllium-20090901
val with_null : (unit -> 'a) -> ('b, Format.formatter, unit, 'a) Pervasives.format4 -> 'b
Discards the message and call the continuation.
Since Beryllium-20090901
val set_output : (string -> int -> int -> unit) -> (unit -> unit) -> unit
This function has the same parameters as Format.make_formatter.
Since Beryllium-20090901
val print_on_output : ('a, Format.formatter, unit) Pervasives.format -> 'a
Direct printing on output. Message echo is delayed until the output is finished. Then, the output is flushed and all pending message are echoed. Notification of listeners is not delayed, however.

Can not be recursively invoked.
Since Beryllium-20090901

val print_delayed : ('a, Format.formatter, unit) Pervasives.format -> 'a
Direct printing on output. Same as print_on_output, except that message echo is not delayed until text material is actually written. This gives an chance for formatters to emit messages before actual pretty printing.

Can not be recursively invoked.
Since Beryllium-20090901