package binsec

  1. Overview
  2. Docs

doc/binsec.cli/Binsec_cli/Cli/Make/Logger/index.html

Module Make.LoggerSource

Channels

Sourcetype channel
Sourceval fatal_channel : channel
Sourceval error_channel : channel
Sourceval result_channel : channel
Sourceval warning_channel : channel
Sourceval info_channel : channel
Sourceval debug_channel : channel

These predefined channels are flushed after each call and a newline character is inserted.

Sourceval fatal : ?e:exn -> ('a, Format.formatter, unit, 'b) format4 -> 'a

For messages that show a fatal failure, In this case, you should not be able to continue and exit code should follow the emission. Use error otherwise.

Sourceval error : ('a, Format.formatter, unit) format -> 'a

For error messages only.

Sourceval result : ('a, Format.formatter, unit) format -> 'a

For important results that will be displayed

Sourceval warning : ?level:int -> ('a, Format.formatter, unit) format -> 'a

For warning messages.

Sourceval set_warning_level : int -> unit
Sourceval get_warning_level : unit -> int
Sourceval info : ?level:int -> ('a, Format.formatter, unit) format -> 'a

Any info that should be displayed

Sourceval set_info_level : int -> unit
Sourceval get_info_level : unit -> int
Sourceval debug : ?level:int -> ('a, Format.formatter, unit) format -> 'a

debug ~level:n msg will be displayed if at least level n + 1 debug is activated

Sourceval fdebug : ?level:int -> (unit -> (unit, Format.formatter, unit) format) -> unit

fdebug ~level f acts like like debug ~level msg where msg = f () but lazily evaluates its argument. Use fdebug instead of debug if you need to print values that might be hard to compute (and that you therefore compute inside the closure).

Sourceval set_debug_level : int -> unit
Sourceval get_debug_level : unit -> int
Sourceval is_debug_enabled : unit -> bool
Sourceval set_tagged_entry : bool -> unit

set_tagged_entry Print channel identifiers, like warning for the warning channel, in front of messages to explicit their origins.

If might not be necessary if you use colors for example.

Sourceval set_log_level : string -> unit

Set logger to display only messages from that channel and those with higher loglevels.

Valid arguments in increasing order of loglevels are : "debug", "info", "warning", "error", "fatal"/"result".

You cannot turn off fatal_channel or result_channel.

Sourceval quiet : unit -> unit
Sourceval channel_set_color : bool -> channel -> unit

set_channel_color b chan activates (if b is true) or deactivates (if b is false) the emission of ANSI color tags for terminal.

You might want to deactivate the feature if you plan on analyzing the log in a file for example.

Sourceval channel_get_color : channel -> bool
Sourceval set_color : bool -> unit

Activate color tags rendering on all outputs.

In your format strings, tags of the form "\@\{<color>format\@\}" will thus be interpreted.

color can be any of the following:

  • black
  • darkgray
  • blue
  • lightblue
  • green
  • lightgreen,
  • cyan
  • lightcyan
  • red
  • lightred
  • purple
  • lightpurple
  • brown
  • yellow
  • lightgray
  • white

format is any format string recognized by Format. For example, after activating color tags Format.printf "\@\{<purple>Hello!\@\}" will write "Hello!" in purple if your terminal has such features.

Sourceval get_color : unit -> bool
Sourceval set_logging : (string -> unit) option -> channel -> unit