test/testpower.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 8149 681eb46b8ac4
     1.1 --- a/test/testpower.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/testpower.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -21,7 +21,7 @@
     1.4      const SDL_PowerState state = SDL_GetPowerInfo(&seconds, &percent);
     1.5      char *statestr = NULL;
     1.6  
     1.7 -    printf("SDL-reported power info...\n");
     1.8 +    SDL_Log("SDL-reported power info...\n");
     1.9      switch (state) {
    1.10      case SDL_POWERSTATE_UNKNOWN:
    1.11          statestr = "Unknown";
    1.12 @@ -43,18 +43,18 @@
    1.13          break;
    1.14      }
    1.15  
    1.16 -    printf("State: %s\n", statestr);
    1.17 +    SDL_Log("State: %s\n", statestr);
    1.18  
    1.19      if (percent == -1) {
    1.20 -        printf("Percent left: unknown\n");
    1.21 +        SDL_Log("Percent left: unknown\n");
    1.22      } else {
    1.23 -        printf("Percent left: %d%%\n", percent);
    1.24 +        SDL_Log("Percent left: %d%%\n", percent);
    1.25      }
    1.26  
    1.27      if (seconds == -1) {
    1.28 -        printf("Time left: unknown\n");
    1.29 +        SDL_Log("Time left: unknown\n");
    1.30      } else {
    1.31 -        printf("Time left: %d minutes, %d seconds\n", (int) (seconds / 60),
    1.32 +        SDL_Log("Time left: %d minutes, %d seconds\n", (int) (seconds / 60),
    1.33                 (int) (seconds % 60));
    1.34      }
    1.35  }
    1.36 @@ -63,8 +63,11 @@
    1.37  int
    1.38  main(int argc, char *argv[])
    1.39  {
    1.40 +    /* Enable standard application logging */
    1.41 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    1.42 +
    1.43      if (SDL_Init(0) == -1) {
    1.44 -        fprintf(stderr, "SDL_Init() failed: %s\n", SDL_GetError());
    1.45 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
    1.46          return 1;
    1.47      }
    1.48