test/testerror.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 8149 681eb46b8ac4
     1.1 --- a/test/testerror.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/testerror.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -36,10 +36,10 @@
     1.4      SDL_SetError("Thread %s (%lu) had a problem: %s",
     1.5                   (char *) data, SDL_ThreadID(), "nevermind");
     1.6      while (alive) {
     1.7 -        printf("Thread '%s' is alive!\n", (char *) data);
     1.8 +        SDL_Log("Thread '%s' is alive!\n", (char *) data);
     1.9          SDL_Delay(1 * 1000);
    1.10      }
    1.11 -    printf("Child thread error string: %s\n", SDL_GetError());
    1.12 +    SDL_Log("Child thread error string: %s\n", SDL_GetError());
    1.13      return (0);
    1.14  }
    1.15  
    1.16 @@ -48,9 +48,12 @@
    1.17  {
    1.18      SDL_Thread *thread;
    1.19  
    1.20 +    /* Enable standard application logging */
    1.21 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    1.22 +
    1.23      /* Load the SDL library */
    1.24      if (SDL_Init(0) < 0) {
    1.25 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.26 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.27          return (1);
    1.28      }
    1.29  
    1.30 @@ -60,15 +63,15 @@
    1.31      alive = 1;
    1.32      thread = SDL_CreateThread(ThreadFunc, NULL, "#1");
    1.33      if (thread == NULL) {
    1.34 -        fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
    1.35 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
    1.36          quit(1);
    1.37      }
    1.38      SDL_Delay(5 * 1000);
    1.39 -    printf("Waiting for thread #1\n");
    1.40 +    SDL_Log("Waiting for thread #1\n");
    1.41      alive = 0;
    1.42      SDL_WaitThread(thread, NULL);
    1.43  
    1.44 -    printf("Main thread error string: %s\n", SDL_GetError());
    1.45 +    SDL_Log("Main thread error string: %s\n", SDL_GetError());
    1.46  
    1.47      SDL_Quit();
    1.48      return (0);