Define macros wrappers for logs

Use macros to wrap SDL_Log* functions with the "application" category.
This commit is contained in:
Romain Vimont
2018-02-13 10:10:18 +01:00
parent d45ef1a295
commit 3ed80a1fac
16 changed files with 105 additions and 81 deletions

View File

@@ -3,7 +3,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL2/SDL_log.h>
#include "log.h"
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
@@ -67,15 +68,15 @@ process_t adb_push(const char *serial, const char *local, const char *remote) {
SDL_bool process_check_success(process_t proc, const char *name) {
if (proc == PROCESS_NONE) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not execute \"%s\"", name);
LOGE("Could not execute \"%s\"", name);
return SDL_FALSE;
}
exit_code_t exit_code;
if (!cmd_simple_wait(proc, &exit_code)) {
if (exit_code != NO_EXIT_CODE) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "\"%s\" returned with value %" PRIexitcode, name, exit_code);
LOGE("\"%s\" returned with value %" PRIexitcode, name, exit_code);
} else {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "\"%s\" exited unexpectedly", name);
LOGE("\"%s\" exited unexpectedly", name);
}
return SDL_FALSE;
}