package lucid

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module LucidSource

Lucid is a super simple logging library.

Log Levels

Sourcetype level =
  1. | Output
  2. | Debug
  3. | Info
  4. | Warn
  5. | Error
  6. | Fatal
Sourceval level_to_string : level option -> string

Converts Level to String

Sourceval level_of_string : string -> (level option, string) result

Converts String to Level

Sourceval level_to_int : level option -> int

Converts Level to Int

    Debug -> 1
    Info -> 2
    Warn -> 3
    Error -> 4
    Fatal -> 5
Sourceval level_of_int : int -> (level option, string) result

Converts Int to level

Sourceval set_level : level -> unit

set_level Warn will set enable logging for Warn and the levels above it.

Sourceval get_level : unit -> level

Returns the lowest level being logged.

Timestamp

Sourcetype timezone =
  1. | Local
  2. | GMT
  3. | None
Sourceval set_tz : timezone -> unit

set_tz GMT will set the timestamp timezone to GMT.

Sourceval get_tz : unit -> timezone

Returns the timezone being used for the timestamp.

Sourceval disable_tz : unit -> unit

Disables timestamps, timestamps can be enabled again using set_tz.

Log Functions

Sourceval debug : string -> unit

debug "message" will log message with the level Debug.

Sourceval info : string -> unit

info "message" will log message with the level Info.

Sourceval warn : string -> unit

warn "message" will log message with the level Warn.

Sourceval error : string -> unit

error "message" will log message with the level Error.

Sourceval fatal : string -> unit

fatal "message" will log message with the level Fatal.

Sourceval critical : string -> unit

Same as fatal

critical "message" will log message with the level Fatal.

Output Channel

Sourceval set_out_channel : out_channel -> unit
Sourceval get_out_channel : unit -> out_channel

Colors

Sourcetype color =
  1. | Black
  2. | Red
  3. | Green
  4. | Yellow
  5. | Blue
  6. | Magenta
  7. | Cyan
  8. | White
  9. | Custom of int
Sourceval set_color_fg : clr:color -> lvl:level -> unit

Set foreground color of the logging label for a certain level.

Sourceval set_color_fg_brt : clr:color -> lvl:level -> unit

Same as set_color_fg but uses bright colors.

Sourceval set_color_bg : clr:color -> lvl:level -> unit

Set background color of the logging label for a certain level.

Sourceval set_color_bg_brt : clr:color -> lvl:level -> unit

Same as set_color_bg but uses bright colors.

Sourceval get_color : level -> string * string

get_color Error will return a 2-tuple string * string where the first string corresponds to the foreground color of the level Error and second to the background color.

Counters

Sourceval get_count : level -> int

Gets the number of times a certain level has been successfully called to log.

Sourceval get_count_logged : level -> int

Gets the number of times a certain level has actually logged.

Sourceval get_count_unlogged : level -> int

get_count - get_count_logged

Sourceval set_count : lvl:level -> int -> unit
Sourceval set_count_logged : lvl:level -> int -> unit
Sourceval count_total : unit -> int
Sourceval count_total_logged : unit -> int
OCaml

Innovation. Community. Security.