Skip to content
Permalink
Browse files

Always log warning and error messages

Not just if `S2D_Diagnostics` set. Also add tests for logging functions.
  • Loading branch information...
blacktm committed Mar 4, 2019
1 parent 365bbb7 commit c6c39fbf8fbf3e2de8f01666e3a8f5d511fa7aff
Showing with 12 additions and 1 deletion.
  1. +3 −1 src/simple2d.c
  2. +9 −0 test/auto.c
@@ -45,7 +45,9 @@ bool S2D_FileExists(const char *path) {
* Logs standard messages to the console
*/
void S2D_Log(int type, const char *msg, ...) {
if (S2D_diagnostics) {

// Always log if diagnostics set, or if a warning or error message
if (S2D_diagnostics || type != S2D_INFO) {

va_list args;
va_start(args, msg);
@@ -41,6 +41,15 @@ int main() {
S2D_Windows_EnableTerminalColors();
start_test_suite();

// Logging ///////////////////////////////////////////////////////////////////

start_test("(S2D_Log) log info, warning, and error messages");
S2D_Log(S2D_INFO, "(S2D_Log) %s", "An `S2D_INFO` message");
S2D_Log(S2D_WARN, "(S2D_Log) %s", "An `S2D_WARN` message");
S2D_Log(S2D_ERROR, "(S2D_Log) %s", "An `S2D_ERROR` message");
S2D_Error("S2D_Error", "An error message");
end_test(true);

// Images ////////////////////////////////////////////////////////////////////

start_test("(S2D_CreateImage) create images with supported formats");

0 comments on commit c6c39fb

Please sign in to comment.
You can’t perform that action at this time.