OCaml: Add debug logging tests

This commit is contained in:
Juno Takano 2025-04-21 21:30:59 -03:00
commit f3557d5bb4
5 changed files with 39 additions and 7 deletions

10
ocaml/lib/system/os.ml Normal file
View file

@ -0,0 +1,10 @@
(* the side effect could be extracted to a log list in the schema *)
let identify : string =
let os_release = String.split_on_char '\n' (File.read "/etc/os-release") in
Utilities.Log.elog (String.concat "\n" os_release);
let os_equals = List.find (String.starts_with ~prefix:"NAME=") os_release in
match String.split_on_char '=' os_equals with
| [ _; s ] ->
String.trim @@ String.map (fun c -> if c = '"' then ' ' else c) s
| _ -> "Unknown"