module Basics: sig end
logging and timing functions, including some simple conversion functions.
val log_file : string -> unit
Start writing to the given logfile
val close_log : unit -> unit
Close the logfile again
val logging : int -> string -> unit
Log with the given level
the message
. This includes the current time.
val log_level : int -> unit
Set the current logging level:
- 0: log only error
- 1: log general messages (starting, stopping)
- 2: log also usage messages (connections)
- 3: log communication
- 4: log creation of internal structures at startup
- 5: log function usage
- 6: log everything
val get_level : unit -> int
Get the current logging level.
val time : unit -> float
Get the last calculated time, faster than the system call.
val calc_time : unit -> unit
Recalculate the current time, typical in the main loop of the program.
val string_of_time : float -> string
Give a string presentation of the give time.
val string_of_dec : int -> int -> string
Create a fixed length
string of the given number
val string_of_hex : int -> string
Create a hexedecimal presentation of the given number
val string_of_fhex : int -> int -> string
Create a hexedecimal presentation with a fixed length
of the given number
val string_of_oct : int -> string
Create a octogonal presentation of the given number
val string_sub : string -> int -> int -> string
Get the substring from a string
from position from
with length
.
This is the same function as String.sub but it will never raise an exception.
And a negative from
value is counted from the right side of the string.
val string_of_charlist : char list -> string
Convert a list of characters to a string
val charlist_of_string : string -> char list
Convert a string to a character list
val sindex : string -> string -> int
Get the position withing str
of substr
or -1 when nothing is found
val sindex_from : string -> string -> int -> int
Get the position withing str
of substr
from position
or -1 when nothing is found
val string_split : string -> string list -> (string * string) list
Split a string on possible substrings and return the remaining parts
val string_list : string -> string -> string list
Create a list of parts of the strings
split
on the second string