[client,sdl] add log functions
This commit is contained in:
parent
defa74b94b
commit
a1b764019d
@ -99,3 +99,25 @@ const char* sdl_event_type_str(Uint32 type)
|
||||
#undef EV_CASE_STR
|
||||
#undef STR
|
||||
}
|
||||
|
||||
const char* sdl_error_string(Uint32 res)
|
||||
{
|
||||
if (res >= 0)
|
||||
return NULL;
|
||||
|
||||
return SDL_GetError();
|
||||
}
|
||||
|
||||
BOOL sdl_log_error_ex(Uint32 res, wLog* log, const char* what, const char* file, size_t line,
|
||||
const char* fkt)
|
||||
{
|
||||
const char* msg = sdl_error_string(res);
|
||||
|
||||
WINPR_UNUSED(file);
|
||||
|
||||
if (!msg)
|
||||
return FALSE;
|
||||
|
||||
WLog_Print(log, WLOG_ERROR, "[%s:%" PRIuz "][%s]: %s", fkt, line, what, msg);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -20,9 +20,16 @@
|
||||
#ifndef FREERDP_CLIENT_SDL_UTILS_H
|
||||
#define FREERDP_CLIENT_SDL_UTILS_H
|
||||
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <SDL.h>
|
||||
|
||||
const char* sdl_event_type_str(Uint32 type);
|
||||
const char* sdl_error_string(Uint32 res);
|
||||
|
||||
#define sdl_log_error(res, log, what) sdl_log_error(res, log, what, __FILE__ __LINE__, __FUNCTION__)
|
||||
BOOL sdl_log_error_ex(Uint32 res, wLog* log, const char* what, const char* file, size_t line,
|
||||
const char* fkt);
|
||||
|
||||
#endif /* FREERDP_CLIENT_SDL_UTILS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user