Frama-C:
Plug-ins:
Libraries:

Frama-C API - Log

Logging Services for Frama-C Kernel and Plugins.

  • since Beryllium-20090601-beta1
type kind =
  1. | Result
  2. | Feedback
  3. | Debug
  4. | Warning
  5. | Error
  6. | Failure
    (*
    • since Beryllium-20090601-beta1
    *)
type event = {
  1. evt_kind : kind;
  2. evt_plugin : string;
  3. evt_category : string option;
    (*

    message or warning category

    *)
  4. evt_source : Filepath.position option;
  5. evt_message : string;
}
  • since Beryllium-20090601-beta1
type 'a pretty_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.

  • When 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 Current_loc).
  • source is the location to be output. If nil, current is used to determine if a location should be output
  • emitwith function which is called each time an event is processed
  • echo is true if the event should be output somewhere in addition to stdout
  • append adds some actions performed on the formatter after the event has been processed.
  • since Beryllium-20090601-beta1
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

Same as Log.pretty_printer except that channels having this type denote a fatal error aborting Frama-C.

  • since Beryllium-20090601-beta1

Exception Registry

  • since Beryllium-20090601-beta1
exception AbortError of string

User error that prevents a plugin to terminate. Argument is the name of the plugin.

  • since Beryllium-20090601-beta1
exception AbortFatal of string

Internal error that prevents a plugin to terminate. Argument is the name of the plugin.

  • since Beryllium-20090601-beta1
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'.

  • before 23.0-Vanadium

    there was no source location

Option_signature.Interface

  • since Beryllium-20090601-beta1
type ontty = [
  1. | `Message
    (*

    Normal message (default)

    *)
  2. | `Feedback
    (*

    Temporary visible on console, normal message otherwise

    *)
  3. | `Transient
    (*

    Temporary visible, only on console

    *)
  4. | `Silent
    (*

    Not visible on console

    *)
]
type warn_status =
  1. | Winactive
    (*

    nothing is emitted.

    *)
  2. | Wfeedback_once
    (*

    combines feedback and once.

    *)
  3. | Wfeedback
    (*

    emit a feedback message.

    *)
  4. | Wonce
    (*

    emit a warning message, but only the first time the category is encountered.

    *)
  5. | Wactive
    (*

    emit a warning message.

    *)
  6. | Werror_once
    (*

    combines once and error.

    *)
  7. | Werror
    (*

    emit a message. Execution continues, but exit status will not be 0

    *)
  8. | Wabort
    (*

    emit a message and abort execution

    *)

status of a warning category

  • since Chlorine-20180501
module type Messages = sig ... end
val evt_category : event -> string list

Split an event category into its constituants.

  • since 18.0-Argon
val split_category : string -> string list

Split a category specification into its constituants. "*" is considered as empty, and "" categories are skipped.

  • since 18.0-Argon
val is_subcategory : string list -> string list -> bool

Sub-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).

  • since 18.0-Argon
module Register (_ : sig ... end) : Messages

Each plugin has its own channel to output messages. This functor should not be directly applied by plug-in developer. They should apply Plugin.Register instead.

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.

Warning: when executing the listener, all listeners will be temporarily deactivated in order to avoid infinite recursion.

  • 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

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
val log_channel : channel -> ?kind:kind -> 'a pretty_printer

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 source : file:Filepath.Normalized.t -> line:int -> Filepath.position
  • since Chlorine-20180501
val get_current_source : unit -> Filepath.position

Terminal interface

This is the low-level interface to logging services. Not to be used by casual users.

val clean : unit -> unit

Flushes the last transient message if necessary.

val set_output : ?isatty:bool -> (string -> int -> int -> unit) -> (unit -> unit) -> unit

This function has the same parameters as Format.make_formatter.

  • since Beryllium-20090901
val print_on_output : (Stdlib.Format.formatter -> unit) -> unit

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 : (Stdlib.Format.formatter -> unit) -> unit

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