From a5509b5bcdd558e2ffa0c8d064eea6ff138c7dcc Mon Sep 17 00:00:00 2001 From: Steve Date: Sat, 12 Mar 2016 15:12:52 +0000 Subject: [PATCH] Logging updates. --- src/battle/capitalShips.c | 4 ++++ src/battle/fighters.c | 4 ++++ src/battle/script.c | 2 +- src/galaxy/mission.c | 4 ++++ src/main.c | 5 ++++- src/system/i18n.c | 2 +- src/system/init.c | 4 ++-- src/system/widgets.c | 4 ++++ 8 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/battle/capitalShips.c b/src/battle/capitalShips.c index b5910cd..12f0aed 100644 --- a/src/battle/capitalShips.c +++ b/src/battle/capitalShips.c @@ -379,6 +379,10 @@ static void loadCapitalShipDef(char *filename) cJSON_Delete(root); } + else + { + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Failed to load '%s'", filename); + } free(text); } diff --git a/src/battle/fighters.c b/src/battle/fighters.c index 11b1339..7c8ec45 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -764,6 +764,10 @@ static void loadFighterDef(char *filename) cJSON_Delete(root); } + else + { + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Failed to load '%s'", filename); + } free(text); } diff --git a/src/battle/script.c b/src/battle/script.c index 91b58c4..929422b 100644 --- a/src/battle/script.c +++ b/src/battle/script.c @@ -41,7 +41,7 @@ void initScript(cJSON *scriptNode) while (function) { - SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Script Function: '%s'", cJSON_GetObjectItem(function, "function")->valuestring); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Found script function: '%s'", cJSON_GetObjectItem(function, "function")->valuestring); function = function->next; } diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 1f5150c..69700eb 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -121,6 +121,10 @@ Mission *loadMissionMeta(char *filename) cJSON_Delete(root); } + else + { + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Failed to load '%s'", filename); + } free(text); diff --git a/src/main.c b/src/main.c index c1d08d7..6617833 100644 --- a/src/main.c +++ b/src/main.c @@ -27,9 +27,10 @@ int main(int argc, char *argv[]) float td; long then, lastFrameTime, frames; long expireTextTimer; - SDL_Event event; + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN); + memset(&app, 0, sizeof(App)); memset(&dev, 0, sizeof(Dev)); @@ -169,6 +170,8 @@ static void handleArguments(int argc, char *argv[]) dev.debug = 1; createScreenshotFolder(); + + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG); } } } diff --git a/src/system/i18n.c b/src/system/i18n.c index 6f17493..7283929 100644 --- a/src/system/i18n.c +++ b/src/system/i18n.c @@ -79,7 +79,7 @@ void setLanguage(char *applicationName, char *languageCode) STRNCPY(language, lang, MAX_LINE_LENGTH); } - printf("Locale is %s\n", language); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Locale is %s", language); sprintf(c, "%s/%s/LC_MESSAGES/%s.mo", LOCALE_DIR, language, applicationName); diff --git a/src/system/init.c b/src/system/init.c index e9651c6..2d04920 100644 --- a/src/system/init.c +++ b/src/system/init.c @@ -338,10 +338,10 @@ void cleanup(void) destroyWidgets(); destroyResources(); + + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Done"); TTF_Quit(); SDL_Quit(); - - SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Done"); } diff --git a/src/system/widgets.c b/src/system/widgets.c index 67690b0..d8fa666 100644 --- a/src/system/widgets.c +++ b/src/system/widgets.c @@ -427,6 +427,10 @@ static void loadWidgetSet(char *filename) cJSON_Delete(root); } + else + { + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Failed to load '%s'", filename); + } free(text); }