forked from Columpio/RInGen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Options.fs
31 lines (23 loc) · 1.18 KB
/
Options.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[<AutoOpen>]
module RInGen.Options
let mutable SECONDS_TIMEOUT = 5 * 60
let MSECONDS_TIMEOUT () = SECONDS_TIMEOUT * 1000
let MSECONDS_TIMEOUT_WITH_DELAY () = MSECONDS_TIMEOUT () + 1000 // + 1 second
let MEMORY_LIMIT_MB = 8L * (1L <<< 10)
type MODES = VERBOSE_MODE | QUIET_MODE | EXTRA_VERBOSE_MODE
let mutable VERBOSITY_MODE = VERBOSE_MODE
let IN_QUIET_MODE () = VERBOSITY_MODE = QUIET_MODE
let IN_VERBOSE_MODE () = VERBOSITY_MODE = VERBOSE_MODE || VERBOSITY_MODE = EXTRA_VERBOSE_MODE
let IN_EXTRA_VERBOSE_MODE () = VERBOSITY_MODE = EXTRA_VERBOSE_MODE
let print_verbose (format : string) : unit =
if IN_VERBOSE_MODE () then printfn $"%s{format}" else ()
let print_extra_verbose (format : string) : unit =
if IN_EXTRA_VERBOSE_MODE () then printfn $"%s{format}" else ()
let print_err_verbose (format : string) : unit =
print_verbose $"Error: %s{format}"
let print_warn_verbose (format : string) : unit =
print_verbose $"Warning: %s{format}"
let failwith_verbose (format : string) : 'T =
if IN_VERBOSE_MODE () then failwith format else Unchecked.defaultof<'T>
let eprint_extra_verbose (format : string) : unit =
if IN_EXTRA_VERBOSE_MODE () then eprintfn $"%s{format}" else ()