module Log:sig..end
Logging Services for Frama-C Kernel and Plugins.
type kind =
| |
Result |
| |
Feedback |
| |
Debug |
| |
Warning |
| |
Error |
| |
Failure |
type event = {
|
evt_kind : |
|||
|
evt_plugin : |
|||
|
evt_category : |
(* | message or warning category | *) |
|
evt_source : |
|||
|
evt_message : |
}
type'apretty_printer =?current:bool ->
?source:Filepath.position ->
?emitwith:(event -> unit) ->
?echo:bool ->
?once:bool ->
?append:(Stdlib.Format.formatter -> unit) ->
('a, Stdlib.Format.formatter, unit) Stdlib.format -> 'a
Generic type for the various logging channels which are not aborting Frama-C.
current is false (default for most of the channels),
no location is output. When it is true, the last registered location
is used as current (see Cil_const.CurrentLoc).source is the location to be output. If nil, current is used to
determine if a location should be outputemitwith function which is called each time an event is processedecho is true if the event should be output somewhere in addition
to stdoutappend adds some actions performed on the formatter after the event
has been processed.type('a, 'b)pretty_aborter =?current:bool ->
?source:Filepath.position ->
?echo:bool ->
?append:(Stdlib.Format.formatter -> unit) ->
('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'a
exception AbortError of string
User error that prevents a plugin to terminate. Argument is the name of the plugin.
exception AbortFatal of string
Internal error that prevents a plugin to terminate. Argument is the name of the plugin.
exception FeatureRequest of Filepath.position option * string * string
Raised by not_yet_implemented.
You may catch FeatureRequest(s,p,r) to support degenerated behavior.
The (optional) source location is s, the responsible plugin is 'p'
and the feature request is 'r'.
typeontty =[ `Feedback | `Message | `Silent | `Transient ]
type warn_status =
| |
Winactive |
(* | nothing is emitted. | *) |
| |
Wfeedback_once |
(* | combines feedback and once. | *) |
| |
Wfeedback |
(* | emit a feedback message. | *) |
| |
Wonce |
(* | emit a warning message, but only the first time the category is encountered. | *) |
| |
Wactive |
(* | emit a warning message. | *) |
| |
Werror_once |
(* | combines once and error. | *) |
| |
Werror |
(* | emit a message. Execution continues, but exit status will not be 0 | *) |
| |
Wabort |
(* | emit a message and abort execution | *) |
status of a warning category
module type Messages =sig..end
val evt_category : event -> string listSplit an event category into its constituants.
val split_category : string -> string listSplit a category specification into its constituants.
"*" is considered as empty, and "" categories are skipped.
val is_subcategory : string list -> string list -> boolSub-category checks.
is_subcategory a b checks whether a is a sub-category of b.
Indeed, it checks whether b is a prefix of a, that is,
that a equals b or refines b with (a list of) sub-category(ies).
module Register:functor (P:sigval channel :stringval label :stringval verbose_atleast :int -> boolval debug_atleast :int -> boolend) ->Messages
Each plugin has its own channel to output messages.
val set_echo : ?plugin:string -> ?kind:kind list -> bool -> unitTurns echo on or off. Applies to all channel unless specified, and all kind of messages unless specified.
val add_listener : ?plugin:string -> ?kind:kind list -> (event -> unit) -> unitRegister a hook that is called each time an event is emitted. Applies to all channel unless specified, and all kind of messages unless specified.
Warning: when executing the listener, all listeners will be temporarily deactivated in order to avoid infinite recursion.
val echo : event -> unitDisplay an event of the terminal, unless echo has been turned off.
val notify : event -> unitSend an event over the associated listeners.
This is the low-level interface to logging services. Not to be used by casual users.
type channel
val new_channel : string -> channelval log_channel : channel -> ?kind:kind -> 'a pretty_printerlogging function to user-created channel.
val kernel_channel_name : stringthe reserved channel name used by the Frama-C kernel.
val kernel_label_name : stringthe reserved label name used by the Frama-C kernel.
val source : file:Filepath.Normalized.t -> line:int -> Filepath.positionfileval get_current_source : unit -> Filepath.positionThis is the low-level interface to logging services. Not to be used by casual users.
val clean : unit -> unitFlushes the last transient message if necessary.
val null : Stdlib.Format.formatter
val nullprintf : ('a, Stdlib.Format.formatter, unit) Stdlib.format -> 'aPretty_utils instead.Discards the message and returns unit.
val with_null : (unit -> 'b) -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'aPretty_utils instead.Discards the message and call the continuation.
val set_output : ?isatty:bool -> (string -> int -> int -> unit) -> (unit -> unit) -> unitThis function has the same parameters as Format.make_formatter.
val print_on_output : (Stdlib.Format.formatter -> unit) -> unitDirect 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.
val print_delayed : (Stdlib.Format.formatter -> unit) -> unitDirect 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.