retroarch_logger: Append the calling function name to the log message.

Makes tracing back a little easier.
This commit is contained in:
Lioncash 2014-09-13 19:49:24 -04:00
parent caebce79fb
commit 3912b3fee4
6 changed files with 37 additions and 29 deletions

View File

@ -152,7 +152,7 @@ static bool init_font(menu_handle_t *menu, const uint8_t *font_bmp_buf)
if (!font) if (!font)
{ {
RARCH_ERR("Font memory allocation failed in %s", __FUNCTION__); RARCH_ERR("Font memory allocation failed.\n");
return false; return false;
} }

View File

@ -207,7 +207,7 @@ static bool gl_shader_init(gl_t *gl)
if (!gl) if (!gl)
{ {
RARCH_ERR("Invalid GL instance passed to %s", __FUNCTION__); RARCH_ERR("Invalid GL instance passed.\n");
return false; return false;
} }

View File

@ -88,7 +88,7 @@ state_tracker_t* state_tracker_init(const struct state_tracker_info *info)
if (!tracker->info) if (!tracker->info)
{ {
RARCH_ERR("%s: Allocation of state tracker info failed.", __FUNCTION__); RARCH_ERR("Allocation of state tracker info failed.\n");
free(tracker); free(tracker);
return NULL; return NULL;
} }

View File

@ -75,7 +75,7 @@ void msg_queue_push(msg_queue_t *queue, const char *msg,
calloc(1, sizeof(struct queue_elem)); calloc(1, sizeof(struct queue_elem));
if (!new_elem) if (!new_elem)
{ {
RARCH_ERR("New element allocation failed in %s", __FUNCTION__); RARCH_ERR("New element allocation failed.\n");
return; return;
} }

View File

@ -51,14 +51,16 @@
#define RARCH_LOG(...) do { \ #define RARCH_LOG(...) do { \
if (RARCH_LOG_VERBOSE) \ if (RARCH_LOG_VERBOSE) \
{ \ { \
fprintf(LOG_FILE, "RetroArch: " __VA_ARGS__); \ fprintf(LOG_FILE, "RetroArch: %s: ", __FUNCTION__); \
fprintf(LOG_FILE, __VA_ARGS__); \
fflush(LOG_FILE); \ fflush(LOG_FILE); \
} \ } \
} while (0) } while (0)
#define RARCH_LOG_V(tag, fmt, vp) do { \ #define RARCH_LOG_V(tag, fmt, vp) do { \
if (RARCH_LOG_VERBOSE) \ if (RARCH_LOG_VERBOSE) \
{ \ { \
fprintf(LOG_FILE, "RetroArch: " tag); \ fprintf(LOG_FILE, "RetroArch: %s: " __FUNCTION__); \
fprintf(LOG_FILE, tag);\
vfprintf(LOG_FILE, fmt, vp); \ vfprintf(LOG_FILE, fmt, vp); \
fflush(LOG_FILE); \ fflush(LOG_FILE); \
} \ } \
@ -68,24 +70,28 @@
#ifndef RARCH_LOG_OUTPUT #ifndef RARCH_LOG_OUTPUT
#undef RARCH_LOG_OUTPUT_V #undef RARCH_LOG_OUTPUT_V
#define RARCH_LOG_OUTPUT(...) do { \ #define RARCH_LOG_OUTPUT(...) do { \
fprintf(LOG_FILE, __VA_ARGS__); \ fprintf(LOG_FILE, "%s: ", __FUNCTION__); \
fflush(LOG_FILE); \ fprintf(LOG_FILE, __VA_ARGS__); \
fflush(LOG_FILE); \
} while (0) } while (0)
#define RARCH_LOG_OUTPUT_V(tag, fmt, vp) do { \ #define RARCH_LOG_OUTPUT_V(tag, fmt, vp) do { \
fprintf(LOG_FILE, "RetroArch: " tag); \ fprintf(LOG_FILE, "RetroArch: %s: ", __FUNCTION__); \
vfprintf(LOG_FILE, fmt, vp); \ fprintf(LOG_FILE, tag); \
fflush(LOG_FILE); \ vfprintf(LOG_FILE, fmt, vp); \
fflush(LOG_FILE); \
} while (0) } while (0)
#endif #endif
#ifndef RARCH_ERR #ifndef RARCH_ERR
#undef RARCH_ERR_V #undef RARCH_ERR_V
#define RARCH_ERR(...) do { \ #define RARCH_ERR(...) do { \
fprintf(LOG_FILE, "RetroArch [ERROR] :: " __VA_ARGS__); \ fprintf(LOG_FILE, "RetroArch [ERROR] :: %s :: ", __FUNCTION__); \
fprintf(LOG_FILE, __VA_ARGS__); \
fflush(LOG_FILE); \ fflush(LOG_FILE); \
} while (0) } while (0)
#define RARCH_ERR_V(tag, fmt, vp) do { \ #define RARCH_ERR_V(tag, fmt, vp) do { \
fprintf(LOG_FILE, "RetroArch [ERROR] :: " tag); \ fprintf(LOG_FILE, "RetroArch [ERROR] :: %s :: ", __FUNCTION__); \
fprintf(LOG_FILE, tag); \
vfprintf(LOG_FILE, fmt, vp); \ vfprintf(LOG_FILE, fmt, vp); \
fflush(LOG_FILE); \ fflush(LOG_FILE); \
} while (0) } while (0)
@ -94,11 +100,13 @@
#ifndef RARCH_WARN #ifndef RARCH_WARN
#undef RARCH_WARN_V #undef RARCH_WARN_V
#define RARCH_WARN(...) do { \ #define RARCH_WARN(...) do { \
fprintf(LOG_FILE, "RetroArch [WARN] :: " __VA_ARGS__); \ fprintf(LOG_FILE, "RetroArch [WARN] :: %s :: ", __FUNCTION__); \
fprintf(LOG_FILE, __VA_ARGS__); \
fflush(LOG_FILE); \ fflush(LOG_FILE); \
} while (0) } while (0)
#define RARCH_WARN_V(tag, fmt, vp) do { \ #define RARCH_WARN_V(tag, fmt, vp) do { \
fprintf(LOG_FILE, "RetroArch [WARN] :: " tag); \ fprintf(LOG_FILE, "RetroArch [WARN] :: %s :: ", __FUNCTION__); \
fprintf(LOG_FILE, tag); \
vfprintf(LOG_FILE, fmt, vp); \ vfprintf(LOG_FILE, fmt, vp); \
fflush(LOG_FILE); \ fflush(LOG_FILE); \
} while (0) } while (0)

View File

@ -43,13 +43,13 @@ static void get_input_config_prefix(char *buf, size_t sizeof_buf,
{ {
if (!buf) if (!buf)
{ {
RARCH_ERR("Null buffer passed to %s", __FUNCTION__); RARCH_ERR("Null buffer passed.\n");
return; return;
} }
if (!setting) if (!setting)
{ {
RARCH_ERR("Null setting passed to %s", __FUNCTION__); RARCH_ERR("Null setting passed.\n");
return; return;
} }
@ -64,13 +64,13 @@ static void get_input_config_key(char *buf, size_t sizeof_buf,
if (!buf) if (!buf)
{ {
RARCH_ERR("Null buffer passed to %s", __FUNCTION__); RARCH_ERR("Null buffer passed.\n");
return; return;
} }
if (!setting) if (!setting)
{ {
RARCH_ERR("Null setting passed to %s", __FUNCTION__); RARCH_ERR("Null setting passed.\n");
return; return;
} }
@ -89,13 +89,13 @@ static void get_key_name(char *buf, size_t sizeof_buf,
if (!buf) if (!buf)
{ {
RARCH_ERR("Null buffer passed to %s", __FUNCTION__); RARCH_ERR("Null buffer passed.\n");
return; return;
} }
if (!setting) if (!setting)
{ {
RARCH_ERR("Null setting passed to %s", __FUNCTION__); RARCH_ERR("Null setting passed.\n");
return; return;
} }
@ -120,13 +120,13 @@ static void get_button_name(char *buf, size_t sizeof_buf,
{ {
if (!buf) if (!buf)
{ {
RARCH_ERR("Null buffer passed to %s", __FUNCTION__); RARCH_ERR("Null buffer passed.\n");
return; return;
} }
if (!setting) if (!setting)
{ {
RARCH_ERR("Null setting passed to %s", __FUNCTION__); RARCH_ERR("Null setting passed.\n");
return; return;
} }
@ -144,13 +144,13 @@ static void get_axis_name(char *buf, size_t sizeof_buf,
if (!buf) if (!buf)
{ {
RARCH_ERR("Null buffer passed to %s", __FUNCTION__); RARCH_ERR("Null buffer passed.\n");
return; return;
} }
if (!setting) if (!setting)
{ {
RARCH_ERR("Null setting passed to %s", __FUNCTION__); RARCH_ERR("Null setting passed.\n");
return; return;
} }
@ -166,7 +166,7 @@ void setting_data_reset_setting(const rarch_setting_t* setting)
{ {
if (!setting) if (!setting)
{ {
RARCH_ERR("Null setting passed to %s", __FUNCTION__); RARCH_ERR("Null setting passed.\n");
return; return;
} }
@ -531,7 +531,7 @@ static void menu_common_setting_set_label_st_bool(rarch_setting_t *setting,
{ {
if (!setting) if (!setting)
{ {
RARCH_ERR("Null setting passed to %s", __FUNCTION__); RARCH_ERR("Null setting passed.\n");
return; return;
} }
@ -555,7 +555,7 @@ static void menu_common_setting_set_label_st_uint(rarch_setting_t *setting,
{ {
if (!setting) if (!setting)
{ {
RARCH_ERR("Null setting passed to %s", __FUNCTION__); RARCH_ERR("Null setting passed.\n");
return; return;
} }
@ -629,7 +629,7 @@ static void menu_common_setting_set_label_st_float(rarch_setting_t *setting,
{ {
if (!setting) if (!setting)
{ {
RARCH_ERR("Null setting passed to %s", __FUNCTION__); RARCH_ERR("Null setting passed.\n");
return; return;
} }