src/SDL_log.c
author David Ludwig <dludwig@pobox.com>
Sun, 27 Oct 2013 23:03:11 -0400
changeset 8536 a2be4a225f91
parent 8535 e8ee0708ef5c
child 8582 c3e9a2b93517
permissions -rw-r--r--
WinRT: build fixes, post SDL 2.0.1 update
dludwig@8535
     1
/*
dludwig@8535
     2
  Simple DirectMedia Layer
dludwig@8535
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
dludwig@8535
     4
dludwig@8535
     5
  This software is provided 'as-is', without any express or implied
dludwig@8535
     6
  warranty.  In no event will the authors be held liable for any damages
dludwig@8535
     7
  arising from the use of this software.
dludwig@8535
     8
dludwig@8535
     9
  Permission is granted to anyone to use this software for any purpose,
dludwig@8535
    10
  including commercial applications, and to alter it and redistribute it
dludwig@8535
    11
  freely, subject to the following restrictions:
dludwig@8535
    12
dludwig@8535
    13
  1. The origin of this software must not be misrepresented; you must not
dludwig@8535
    14
     claim that you wrote the original software. If you use this software
dludwig@8535
    15
     in a product, an acknowledgment in the product documentation would be
dludwig@8535
    16
     appreciated but is not required.
dludwig@8535
    17
  2. Altered source versions must be plainly marked as such, and must not be
dludwig@8535
    18
     misrepresented as being the original software.
dludwig@8535
    19
  3. This notice may not be removed or altered from any source distribution.
dludwig@8535
    20
*/
dludwig@8535
    21
#include "SDL_config.h"
dludwig@8535
    22
dludwig@8536
    23
#if defined(__WIN32__) || defined(__WINRT__)
dludwig@8535
    24
#include "core/windows/SDL_windows.h"
dludwig@8535
    25
#endif
dludwig@8535
    26
dludwig@8535
    27
/* Simple log messages in SDL */
dludwig@8535
    28
dludwig@8535
    29
#include "SDL_log.h"
dludwig@8535
    30
dludwig@8535
    31
#if HAVE_STDIO_H
dludwig@8535
    32
#include <stdio.h>
dludwig@8535
    33
#endif
dludwig@8535
    34
dludwig@8535
    35
#if defined(__ANDROID__)
dludwig@8535
    36
#include <android/log.h>
dludwig@8535
    37
#endif
dludwig@8535
    38
dludwig@8535
    39
#define DEFAULT_PRIORITY                SDL_LOG_PRIORITY_CRITICAL
dludwig@8535
    40
#define DEFAULT_ASSERT_PRIORITY         SDL_LOG_PRIORITY_WARN
dludwig@8535
    41
#define DEFAULT_APPLICATION_PRIORITY    SDL_LOG_PRIORITY_INFO
dludwig@8535
    42
#define DEFAULT_TEST_PRIORITY           SDL_LOG_PRIORITY_VERBOSE
dludwig@8535
    43
dludwig@8535
    44
/* Forward definition of error function */
dludwig@8535
    45
extern int SDL_SetError(const char *fmt, ...);
dludwig@8535
    46
dludwig@8535
    47
typedef struct SDL_LogLevel
dludwig@8535
    48
{
dludwig@8535
    49
    int category;
dludwig@8535
    50
    SDL_LogPriority priority;
dludwig@8535
    51
    struct SDL_LogLevel *next;
dludwig@8535
    52
} SDL_LogLevel;
dludwig@8535
    53
dludwig@8535
    54
/* The default log output function */
dludwig@8535
    55
static void SDL_LogOutput(void *userdata,
dludwig@8535
    56
                          int category, SDL_LogPriority priority,
dludwig@8535
    57
                          const char *message);
dludwig@8535
    58
dludwig@8535
    59
static SDL_LogLevel *SDL_loglevels;
dludwig@8535
    60
static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
dludwig@8535
    61
static SDL_LogPriority SDL_assert_priority = DEFAULT_ASSERT_PRIORITY;
dludwig@8535
    62
static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
dludwig@8535
    63
static SDL_LogPriority SDL_test_priority = DEFAULT_TEST_PRIORITY;
dludwig@8535
    64
static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput;
dludwig@8535
    65
static void *SDL_log_userdata = NULL;
dludwig@8535
    66
dludwig@8535
    67
static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = {
dludwig@8535
    68
    NULL,
dludwig@8535
    69
    "VERBOSE",
dludwig@8535
    70
    "DEBUG",
dludwig@8535
    71
    "INFO",
dludwig@8535
    72
    "WARN",
dludwig@8535
    73
    "ERROR",
dludwig@8535
    74
    "CRITICAL"
dludwig@8535
    75
};
dludwig@8535
    76
dludwig@8535
    77
#ifdef __ANDROID__
dludwig@8535
    78
static const char *SDL_category_prefixes[SDL_LOG_CATEGORY_RESERVED1] = {
dludwig@8535
    79
    "APP",
dludwig@8535
    80
    "ERROR",
dludwig@8535
    81
    "SYSTEM",
dludwig@8535
    82
    "AUDIO",
dludwig@8535
    83
    "VIDEO",
dludwig@8535
    84
    "RENDER",
dludwig@8535
    85
    "INPUT"
dludwig@8535
    86
};
dludwig@8535
    87
dludwig@8535
    88
static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = {
dludwig@8535
    89
    ANDROID_LOG_UNKNOWN,
dludwig@8535
    90
    ANDROID_LOG_VERBOSE,
dludwig@8535
    91
    ANDROID_LOG_DEBUG,
dludwig@8535
    92
    ANDROID_LOG_INFO,
dludwig@8535
    93
    ANDROID_LOG_WARN,
dludwig@8535
    94
    ANDROID_LOG_ERROR,
dludwig@8535
    95
    ANDROID_LOG_FATAL
dludwig@8535
    96
};
dludwig@8535
    97
#endif /* __ANDROID__ */
dludwig@8535
    98
dludwig@8535
    99
dludwig@8535
   100
void
dludwig@8535
   101
SDL_LogSetAllPriority(SDL_LogPriority priority)
dludwig@8535
   102
{
dludwig@8535
   103
    SDL_LogLevel *entry;
dludwig@8535
   104
dludwig@8535
   105
    for (entry = SDL_loglevels; entry; entry = entry->next) {
dludwig@8535
   106
        entry->priority = priority;
dludwig@8535
   107
    }
dludwig@8535
   108
    SDL_default_priority = priority;
dludwig@8535
   109
    SDL_assert_priority = priority;
dludwig@8535
   110
    SDL_application_priority = priority;
dludwig@8535
   111
}
dludwig@8535
   112
dludwig@8535
   113
void
dludwig@8535
   114
SDL_LogSetPriority(int category, SDL_LogPriority priority)
dludwig@8535
   115
{
dludwig@8535
   116
    SDL_LogLevel *entry;
dludwig@8535
   117
dludwig@8535
   118
    for (entry = SDL_loglevels; entry; entry = entry->next) {
dludwig@8535
   119
        if (entry->category == category) {
dludwig@8535
   120
            entry->priority = priority;
dludwig@8535
   121
            return;
dludwig@8535
   122
        }
dludwig@8535
   123
    }
dludwig@8535
   124
dludwig@8535
   125
    /* Create a new entry */
dludwig@8535
   126
    entry = (SDL_LogLevel *)SDL_malloc(sizeof(*entry));
dludwig@8535
   127
    if (entry) {
dludwig@8535
   128
        entry->category = category;
dludwig@8535
   129
        entry->priority = priority;
dludwig@8535
   130
        entry->next = SDL_loglevels;
dludwig@8535
   131
        SDL_loglevels = entry;
dludwig@8535
   132
    }
dludwig@8535
   133
}
dludwig@8535
   134
dludwig@8535
   135
SDL_LogPriority
dludwig@8535
   136
SDL_LogGetPriority(int category)
dludwig@8535
   137
{
dludwig@8535
   138
    SDL_LogLevel *entry;
dludwig@8535
   139
dludwig@8535
   140
    for (entry = SDL_loglevels; entry; entry = entry->next) {
dludwig@8535
   141
        if (entry->category == category) {
dludwig@8535
   142
            return entry->priority;
dludwig@8535
   143
        }
dludwig@8535
   144
    }
dludwig@8535
   145
dludwig@8535
   146
    if (category == SDL_LOG_CATEGORY_TEST) {
dludwig@8535
   147
        return SDL_test_priority;
dludwig@8535
   148
    } else if (category == SDL_LOG_CATEGORY_APPLICATION) {
dludwig@8535
   149
        return SDL_application_priority;
dludwig@8535
   150
    } else if (category == SDL_LOG_CATEGORY_ASSERT) {
dludwig@8535
   151
        return SDL_assert_priority;
dludwig@8535
   152
    } else {
dludwig@8535
   153
        return SDL_default_priority;
dludwig@8535
   154
    }
dludwig@8535
   155
}
dludwig@8535
   156
dludwig@8535
   157
void
dludwig@8535
   158
SDL_LogResetPriorities(void)
dludwig@8535
   159
{
dludwig@8535
   160
    SDL_LogLevel *entry;
dludwig@8535
   161
dludwig@8535
   162
    while (SDL_loglevels) {
dludwig@8535
   163
        entry = SDL_loglevels;
dludwig@8535
   164
        SDL_loglevels = entry->next;
dludwig@8535
   165
        SDL_free(entry);
dludwig@8535
   166
    }
dludwig@8535
   167
dludwig@8535
   168
    SDL_default_priority = DEFAULT_PRIORITY;
dludwig@8535
   169
    SDL_assert_priority = DEFAULT_ASSERT_PRIORITY;
dludwig@8535
   170
    SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
dludwig@8535
   171
    SDL_test_priority = DEFAULT_TEST_PRIORITY;
dludwig@8535
   172
}
dludwig@8535
   173
dludwig@8535
   174
void
dludwig@8535
   175
SDL_Log(const char *fmt, ...)
dludwig@8535
   176
{
dludwig@8535
   177
    va_list ap;
dludwig@8535
   178
dludwig@8535
   179
    va_start(ap, fmt);
dludwig@8535
   180
    SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap);
dludwig@8535
   181
    va_end(ap);
dludwig@8535
   182
}
dludwig@8535
   183
dludwig@8535
   184
void
dludwig@8535
   185
SDL_LogVerbose(int category, const char *fmt, ...)
dludwig@8535
   186
{
dludwig@8535
   187
    va_list ap;
dludwig@8535
   188
dludwig@8535
   189
    va_start(ap, fmt);
dludwig@8535
   190
    SDL_LogMessageV(category, SDL_LOG_PRIORITY_VERBOSE, fmt, ap);
dludwig@8535
   191
    va_end(ap);
dludwig@8535
   192
}
dludwig@8535
   193
dludwig@8535
   194
void
dludwig@8535
   195
SDL_LogDebug(int category, const char *fmt, ...)
dludwig@8535
   196
{
dludwig@8535
   197
    va_list ap;
dludwig@8535
   198
dludwig@8535
   199
    va_start(ap, fmt);
dludwig@8535
   200
    SDL_LogMessageV(category, SDL_LOG_PRIORITY_DEBUG, fmt, ap);
dludwig@8535
   201
    va_end(ap);
dludwig@8535
   202
}
dludwig@8535
   203
dludwig@8535
   204
void
dludwig@8535
   205
SDL_LogInfo(int category, const char *fmt, ...)
dludwig@8535
   206
{
dludwig@8535
   207
    va_list ap;
dludwig@8535
   208
dludwig@8535
   209
    va_start(ap, fmt);
dludwig@8535
   210
    SDL_LogMessageV(category, SDL_LOG_PRIORITY_INFO, fmt, ap);
dludwig@8535
   211
    va_end(ap);
dludwig@8535
   212
}
dludwig@8535
   213
dludwig@8535
   214
void
dludwig@8535
   215
SDL_LogWarn(int category, const char *fmt, ...)
dludwig@8535
   216
{
dludwig@8535
   217
    va_list ap;
dludwig@8535
   218
dludwig@8535
   219
    va_start(ap, fmt);
dludwig@8535
   220
    SDL_LogMessageV(category, SDL_LOG_PRIORITY_WARN, fmt, ap);
dludwig@8535
   221
    va_end(ap);
dludwig@8535
   222
}
dludwig@8535
   223
dludwig@8535
   224
void
dludwig@8535
   225
SDL_LogError(int category, const char *fmt, ...)
dludwig@8535
   226
{
dludwig@8535
   227
    va_list ap;
dludwig@8535
   228
dludwig@8535
   229
    va_start(ap, fmt);
dludwig@8535
   230
    SDL_LogMessageV(category, SDL_LOG_PRIORITY_ERROR, fmt, ap);
dludwig@8535
   231
    va_end(ap);
dludwig@8535
   232
}
dludwig@8535
   233
dludwig@8535
   234
void
dludwig@8535
   235
SDL_LogCritical(int category, const char *fmt, ...)
dludwig@8535
   236
{
dludwig@8535
   237
    va_list ap;
dludwig@8535
   238
dludwig@8535
   239
    va_start(ap, fmt);
dludwig@8535
   240
    SDL_LogMessageV(category, SDL_LOG_PRIORITY_CRITICAL, fmt, ap);
dludwig@8535
   241
    va_end(ap);
dludwig@8535
   242
}
dludwig@8535
   243
dludwig@8535
   244
void
dludwig@8535
   245
SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...)
dludwig@8535
   246
{
dludwig@8535
   247
    va_list ap;
dludwig@8535
   248
dludwig@8535
   249
    va_start(ap, fmt);
dludwig@8535
   250
    SDL_LogMessageV(category, priority, fmt, ap);
dludwig@8535
   251
    va_end(ap);
dludwig@8535
   252
}
dludwig@8535
   253
dludwig@8535
   254
#ifdef __ANDROID__
dludwig@8535
   255
static const char *
dludwig@8535
   256
GetCategoryPrefix(int category)
dludwig@8535
   257
{
dludwig@8535
   258
    if (category < SDL_LOG_CATEGORY_RESERVED1) {
dludwig@8535
   259
        return SDL_category_prefixes[category];
dludwig@8535
   260
    }
dludwig@8535
   261
    if (category < SDL_LOG_CATEGORY_CUSTOM) {
dludwig@8535
   262
        return "RESERVED";
dludwig@8535
   263
    }
dludwig@8535
   264
    return "CUSTOM";
dludwig@8535
   265
}
dludwig@8535
   266
#endif /* __ANDROID__ */
dludwig@8535
   267
dludwig@8535
   268
void
dludwig@8535
   269
SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap)
dludwig@8535
   270
{
dludwig@8535
   271
    char *message;
dludwig@8535
   272
    size_t len;
dludwig@8535
   273
dludwig@8535
   274
    /* Nothing to do if we don't have an output function */
dludwig@8535
   275
    if (!SDL_log_function) {
dludwig@8535
   276
        return;
dludwig@8535
   277
    }
dludwig@8535
   278
dludwig@8535
   279
    /* Make sure we don't exceed array bounds */
dludwig@8535
   280
    if ((int)priority < 0 || priority >= SDL_NUM_LOG_PRIORITIES) {
dludwig@8535
   281
        return;
dludwig@8535
   282
    }
dludwig@8535
   283
dludwig@8535
   284
    /* See if we want to do anything with this message */
dludwig@8535
   285
    if (priority < SDL_LogGetPriority(category)) {
dludwig@8535
   286
        return;
dludwig@8535
   287
    }
dludwig@8535
   288
dludwig@8535
   289
    message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
dludwig@8535
   290
    if (!message) {
dludwig@8535
   291
        return;
dludwig@8535
   292
    }
dludwig@8535
   293
dludwig@8535
   294
    SDL_vsnprintf(message, SDL_MAX_LOG_MESSAGE, fmt, ap);
dludwig@8535
   295
dludwig@8535
   296
    /* Chop off final endline. */
dludwig@8535
   297
    len = SDL_strlen(message);
dludwig@8535
   298
    if ((len > 0) && (message[len-1] == '\n')) {
dludwig@8535
   299
        message[--len] = '\0';
dludwig@8535
   300
        if ((len > 0) && (message[len-1] == '\r')) {  /* catch "\r\n", too. */
dludwig@8535
   301
            message[--len] = '\0';
dludwig@8535
   302
        }
dludwig@8535
   303
    }
dludwig@8535
   304
dludwig@8535
   305
    SDL_log_function(SDL_log_userdata, category, priority, message);
dludwig@8535
   306
    SDL_stack_free(message);
dludwig@8535
   307
}
dludwig@8535
   308
dludwig@8535
   309
#if defined(__WIN32__)
dludwig@8535
   310
/* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */
dludwig@8535
   311
static int consoleAttached = 0;
dludwig@8535
   312
dludwig@8535
   313
/* Handle to stderr output of console. */
dludwig@8535
   314
static HANDLE stderrHandle = NULL;
dludwig@8535
   315
#endif
dludwig@8535
   316
dludwig@8535
   317
static void
dludwig@8535
   318
SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
dludwig@8535
   319
              const char *message)
dludwig@8535
   320
{
dludwig@8535
   321
#if defined(__WIN32__) || defined(__WINRT__)
dludwig@8535
   322
    /* Way too many allocations here, urgh */
dludwig@8535
   323
    /* Note: One can't call SDL_SetError here, since that function itself logs. */
dludwig@8535
   324
    {
dludwig@8535
   325
        char *output;
dludwig@8535
   326
        size_t length;
dludwig@8535
   327
        LPTSTR tstr;
dludwig@8535
   328
dludwig@8535
   329
#ifndef __WINRT__
dludwig@8535
   330
        BOOL attachResult;
dludwig@8535
   331
        DWORD attachError;
dludwig@8535
   332
        unsigned long charsWritten; 
dludwig@8535
   333
dludwig@8535
   334
        /* Maybe attach console and get stderr handle */
dludwig@8535
   335
        if (consoleAttached == 0) {
dludwig@8535
   336
            attachResult = AttachConsole(ATTACH_PARENT_PROCESS);
dludwig@8535
   337
            if (!attachResult) {
dludwig@8535
   338
                    attachError = GetLastError();
dludwig@8535
   339
                    if (attachError == ERROR_INVALID_HANDLE) {
dludwig@8535
   340
                        OutputDebugString(TEXT("Parent process has no console\r\n"));
dludwig@8535
   341
                        consoleAttached = -1;
dludwig@8535
   342
                    } else if (attachError == ERROR_GEN_FAILURE) {
dludwig@8535
   343
                         OutputDebugString(TEXT("Could not attach to console of parent process\r\n"));
dludwig@8535
   344
                         consoleAttached = -1;
dludwig@8535
   345
                    } else if (attachError == ERROR_ACCESS_DENIED) {  
dludwig@8535
   346
                         /* Already attached */
dludwig@8535
   347
                        consoleAttached = 1;
dludwig@8535
   348
                    } else {
dludwig@8535
   349
                        OutputDebugString(TEXT("Error attaching console\r\n"));
dludwig@8535
   350
                        consoleAttached = -1;
dludwig@8535
   351
                    }
dludwig@8535
   352
                } else {
dludwig@8535
   353
                    /* Newly attached */
dludwig@8535
   354
                    consoleAttached = 1;
dludwig@8535
   355
                }
dludwig@8535
   356
			
dludwig@8535
   357
                if (consoleAttached == 1) {
dludwig@8535
   358
                        stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
dludwig@8535
   359
                }
dludwig@8535
   360
        }
dludwig@8535
   361
#endif /* ifndef __WINRT__ */
dludwig@8535
   362
dludwig@8535
   363
        length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1;
dludwig@8535
   364
        output = SDL_stack_alloc(char, length);
dludwig@8535
   365
        SDL_snprintf(output, length, "%s: %s\r\n", SDL_priority_prefixes[priority], message);
dludwig@8535
   366
        tstr = WIN_UTF8ToString(output);
dludwig@8535
   367
        
dludwig@8535
   368
        /* Output to debugger */
dludwig@8535
   369
        OutputDebugString(tstr);
dludwig@8535
   370
       
dludwig@8535
   371
#ifndef __WINRT__
dludwig@8535
   372
        /* Screen output to stderr, if console was attached. */
dludwig@8535
   373
        if (consoleAttached == 1) {
dludwig@8535
   374
                if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) {
dludwig@8535
   375
                    OutputDebugString(TEXT("Error calling WriteConsole\r\n"));
dludwig@8535
   376
                }
dludwig@8535
   377
                if (charsWritten == ERROR_NOT_ENOUGH_MEMORY) {
dludwig@8535
   378
                    OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
dludwig@8535
   379
                }
dludwig@8535
   380
        }
dludwig@8535
   381
#endif /* ifndef __WINRT__ */
dludwig@8535
   382
dludwig@8535
   383
        SDL_free(tstr);
dludwig@8535
   384
        SDL_stack_free(output);
dludwig@8535
   385
    }
dludwig@8535
   386
#elif defined(__ANDROID__)
dludwig@8535
   387
    {
dludwig@8535
   388
        char tag[32];
dludwig@8535
   389
dludwig@8535
   390
        SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
dludwig@8535
   391
        __android_log_write(SDL_android_priority[priority], tag, message);
dludwig@8535
   392
    }
dludwig@8535
   393
#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
dludwig@8535
   394
    /* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now.
dludwig@8535
   395
    */
dludwig@8535
   396
    extern void SDL_NSLog(const char *text);
dludwig@8535
   397
    {
dludwig@8535
   398
        char *text;
dludwig@8535
   399
dludwig@8535
   400
        text = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
dludwig@8535
   401
        if (text) {
dludwig@8535
   402
            SDL_snprintf(text, SDL_MAX_LOG_MESSAGE, "%s: %s", SDL_priority_prefixes[priority], message);
dludwig@8535
   403
            SDL_NSLog(text);
dludwig@8535
   404
            SDL_stack_free(text);
dludwig@8535
   405
            return;
dludwig@8535
   406
        }
dludwig@8535
   407
    }
dludwig@8535
   408
#elif defined(__PSP__)
dludwig@8535
   409
    {
dludwig@8535
   410
        FILE*        pFile;
dludwig@8535
   411
        pFile = fopen ("SDL_Log.txt", "a");
dludwig@8535
   412
        fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message);
dludwig@8535
   413
        fclose (pFile);
dludwig@8535
   414
    }
dludwig@8535
   415
#endif
dludwig@8535
   416
#if HAVE_STDIO_H
dludwig@8535
   417
    fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
dludwig@8535
   418
#endif
dludwig@8535
   419
}
dludwig@8535
   420
dludwig@8535
   421
void
dludwig@8535
   422
SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata)
dludwig@8535
   423
{
dludwig@8535
   424
    if (callback) {
dludwig@8535
   425
        *callback = SDL_log_function;
dludwig@8535
   426
    }
dludwig@8535
   427
    if (userdata) {
dludwig@8535
   428
        *userdata = SDL_log_userdata;
dludwig@8535
   429
    }
dludwig@8535
   430
}
dludwig@8535
   431
dludwig@8535
   432
void
dludwig@8535
   433
SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata)
dludwig@8535
   434
{
dludwig@8535
   435
    SDL_log_function = callback;
dludwig@8535
   436
    SDL_log_userdata = userdata;
dludwig@8535
   437
}
dludwig@8535
   438
dludwig@8535
   439
/* vi: set ts=4 sw=4 expandtab: */