Closed MichealReed closed 1 month ago
+1 to the exit policy. Error handling in general will needs some consideration.
There's quite a few places where the return type should conceptionally return optional types (Error or Value), but that does add some complexity to the API and optional types aren't as clean / idiomatic in C++ as they are in rust or zig. OTOH i don't like the idea of throwing exceptions either, but we'll have to bite the bullet one way or another and probably commit to something in the near future.
The way we were printing from LOG caused a crash when embedded on windows. This updates the logger to be more typesafe and generally compatible across platforms.
I removed exit(1) from the check function. We should never automatically exit the program as a library, this can prevent proper logging if there is indeed a crash.
Also introduces a NO_LOG definition that we should add throughout.
Also adds log level 0 for silent output.