comparison test/common.c @ 5239:af8ca17f6b7c

Added the ability to turn on logging output to the test programs
author Sam Lantinga <slouken@libsdl.org>
date Tue, 08 Feb 2011 23:13:28 -0800
parents ad50b3db78bd
children 762e40fb8e28
comparison
equal deleted inserted replaced
5238:ce4f91138031 5239:af8ca17f6b7c
4 #include <stdio.h> 4 #include <stdio.h>
5 5
6 #include "common.h" 6 #include "common.h"
7 7
8 #define VIDEO_USAGE \ 8 #define VIDEO_USAGE \
9 "[--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]" 9 "[--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]"
10 10
11 #define AUDIO_USAGE \ 11 #define AUDIO_USAGE \
12 "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" 12 "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
13 13
14 CommonState * 14 CommonState *
103 state->verbose |= VERBOSE_RENDER; 103 state->verbose |= VERBOSE_RENDER;
104 return 2; 104 return 2;
105 } 105 }
106 if (SDL_strcasecmp(argv[index], "event") == 0) { 106 if (SDL_strcasecmp(argv[index], "event") == 0) {
107 state->verbose |= VERBOSE_EVENT; 107 state->verbose |= VERBOSE_EVENT;
108 return 2;
109 }
110 return -1;
111 }
112 if (SDL_strcasecmp(argv[index], "--log") == 0) {
113 ++index;
114 if (!argv[index]) {
115 return -1;
116 }
117 if (SDL_strcasecmp(argv[index], "all") == 0) {
118 SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
119 return 2;
120 }
121 if (SDL_strcasecmp(argv[index], "error") == 0) {
122 SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_VERBOSE);
123 return 2;
124 }
125 if (SDL_strcasecmp(argv[index], "system") == 0) {
126 SDL_LogSetPriority(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE);
127 return 2;
128 }
129 if (SDL_strcasecmp(argv[index], "audio") == 0) {
130 SDL_LogSetPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE);
131 return 2;
132 }
133 if (SDL_strcasecmp(argv[index], "video") == 0) {
134 SDL_LogSetPriority(SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE);
135 return 2;
136 }
137 if (SDL_strcasecmp(argv[index], "render") == 0) {
138 SDL_LogSetPriority(SDL_LOG_CATEGORY_RENDER, SDL_LOG_PRIORITY_VERBOSE);
139 return 2;
140 }
141 if (SDL_strcasecmp(argv[index], "input") == 0) {
142 SDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE);
108 return 2; 143 return 2;
109 } 144 }
110 return -1; 145 return -1;
111 } 146 }
112 if (SDL_strcasecmp(argv[index], "--display") == 0) { 147 if (SDL_strcasecmp(argv[index], "--display") == 0) {