add the ability to configure logger

This commit is contained in:
zapashcanon 2022-02-19 22:29:17 +01:00
parent 866b78f1f4
commit 23e0add29d
No known key found for this signature in database
GPG key ID: 8981C3C62D1D28F1
2 changed files with 14 additions and 1 deletions

View file

@ -57,3 +57,15 @@ let port =
failwith "invalid `port` value in configuration file" ) )
let () = Dream.log "port: %d" port
let log =
match Scfg.Query.get_dir "log" config with
| None -> true
| Some open_registration -> (
match Scfg.Query.get_param 0 open_registration with
| Error e -> failwith e
| Ok "true" -> true
| Ok "false" -> false
| Ok _unknown -> failwith "invalid `log` value in configuration file" )
let () = Dream.log "log: %b" log