# HG changeset patch # User Sam Lantinga # Date 1297235608 28800 # Node ID af8ca17f6b7cba2e8ca162acdb6afb7276470aaf # Parent ce4f911380316cd408662a6579f4ddeef08a8812 Added the ability to turn on logging output to the test programs diff -r ce4f91138031 -r af8ca17f6b7c test/common.c --- a/test/common.c Tue Feb 08 22:40:19 2011 -0800 +++ b/test/common.c Tue Feb 08 23:13:28 2011 -0800 @@ -6,7 +6,7 @@ #include "common.h" #define VIDEO_USAGE \ -"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display N] [--fullscreen | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]" +"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]" #define AUDIO_USAGE \ "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" @@ -109,6 +109,41 @@ } return -1; } + if (SDL_strcasecmp(argv[index], "--log") == 0) { + ++index; + if (!argv[index]) { + return -1; + } + if (SDL_strcasecmp(argv[index], "all") == 0) { + SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "error") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "system") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "audio") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "video") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "render") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_RENDER, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + if (SDL_strcasecmp(argv[index], "input") == 0) { + SDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE); + return 2; + } + return -1; + } if (SDL_strcasecmp(argv[index], "--display") == 0) { ++index; if (!argv[index]) {