mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Add separate setting for Frontend Logging Level
This commit is contained in:
parent
ad71451432
commit
73663104b3
@ -2640,6 +2640,7 @@ static bool config_load_file(const char *path, settings_t *settings)
|
||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
char *tmp_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
bool ret = false;
|
||||
unsigned tmp_uint = 0;
|
||||
bool tmp_bool = false;
|
||||
unsigned msg_color = 0;
|
||||
char *save = NULL;
|
||||
@ -2741,19 +2742,9 @@ static bool config_load_file(const char *path, settings_t *settings)
|
||||
else
|
||||
verbosity_disable();
|
||||
}
|
||||
if (config_get_uint(conf, "frontend_log_level", &tmp_uint))
|
||||
{
|
||||
char tmp[64];
|
||||
|
||||
tmp[0] = '\0';
|
||||
|
||||
strlcpy(tmp, "perfcnt_enable", sizeof(tmp));
|
||||
if (config_get_bool(conf, tmp, &tmp_bool))
|
||||
{
|
||||
if (tmp_bool)
|
||||
rarch_ctl(RARCH_CTL_SET_PERFCNT_ENABLE, NULL);
|
||||
else
|
||||
rarch_ctl(RARCH_CTL_UNSET_PERFCNT_ENABLE, NULL);
|
||||
}
|
||||
verbosity_set_log_level(tmp_uint);
|
||||
}
|
||||
|
||||
/* Integer settings */
|
||||
|
@ -6063,6 +6063,14 @@ void general_write_handler(rarch_setting_t *setting)
|
||||
command_event(rarch_cmd, NULL);
|
||||
}
|
||||
|
||||
static void frontend_log_level_change_handler(rarch_setting_t *setting)
|
||||
{
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
verbosity_set_log_level(*setting->value.target.unsigned_integer);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
static void overlay_enable_toggle_change_handler(rarch_setting_t *setting)
|
||||
{
|
||||
@ -7593,6 +7601,7 @@ static bool setting_append_list(
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].change_handler = frontend_log_level_change_handler;
|
||||
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_RADIO_BUTTONS;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 3, 1.0, true, true);
|
||||
|
10
retroarch.c
10
retroarch.c
@ -6276,7 +6276,7 @@ static bool environ_cb_get_system_info(unsigned cmd, void *data)
|
||||
const struct retro_subsystem_info *info =
|
||||
(const struct retro_subsystem_info*)data;
|
||||
settings_t *settings = configuration_settings;
|
||||
unsigned log_level = settings->uints.libretro_log_level;
|
||||
unsigned log_level = settings->uints.frontend_log_level;
|
||||
|
||||
subsystem_current_count = 0;
|
||||
|
||||
@ -6690,7 +6690,7 @@ static bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_VARIABLE:
|
||||
{
|
||||
unsigned log_level = settings->uints.libretro_log_level;
|
||||
unsigned log_level = settings->uints.frontend_log_level;
|
||||
struct retro_variable *var = (struct retro_variable*)data;
|
||||
|
||||
if (!var)
|
||||
@ -6992,7 +6992,7 @@ static bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
RARCH_LOG("Environ SET_INPUT_DESCRIPTORS:\n");
|
||||
|
||||
{
|
||||
unsigned log_level = settings->uints.libretro_log_level;
|
||||
unsigned log_level = settings->uints.frontend_log_level;
|
||||
|
||||
if (log_level == RETRO_LOG_DEBUG)
|
||||
{
|
||||
@ -7293,7 +7293,7 @@ static bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
unsigned i;
|
||||
const struct retro_subsystem_info *info =
|
||||
(const struct retro_subsystem_info*)data;
|
||||
unsigned log_level = settings->uints.libretro_log_level;
|
||||
unsigned log_level = settings->uints.frontend_log_level;
|
||||
|
||||
if (log_level == RETRO_LOG_DEBUG)
|
||||
RARCH_LOG("Environ SET_SUBSYSTEM_INFO.\n");
|
||||
@ -7343,7 +7343,7 @@ static bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
unsigned i, j;
|
||||
const struct retro_controller_info *info =
|
||||
(const struct retro_controller_info*)data;
|
||||
unsigned log_level = settings->uints.libretro_log_level;
|
||||
unsigned log_level = settings->uints.frontend_log_level;
|
||||
|
||||
RARCH_LOG("Environ SET_CONTROLLER_INFO.\n");
|
||||
|
||||
|
19
verbosity.c
19
verbosity.c
@ -62,10 +62,17 @@
|
||||
#include "ui/ui_companion_driver.h"
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "config.def.h"
|
||||
#else
|
||||
#define DEFAULT_FRONTEND_LOG_LEVEL 1
|
||||
#endif
|
||||
|
||||
/* If this is non-NULL. RARCH_LOG and friends
|
||||
* will write to this file. */
|
||||
static FILE *log_file_fp = NULL;
|
||||
static void* log_file_buf = NULL;
|
||||
static unsigned verbosity_log_level = DEFAULT_FRONTEND_LOG_LEVEL;
|
||||
static bool main_verbosity = false;
|
||||
static bool log_file_initialized = false;
|
||||
|
||||
@ -76,6 +83,11 @@ bool nxlink_connected = false;
|
||||
#endif /* NXLINK */
|
||||
#endif /* HAVE_LIBNX */
|
||||
|
||||
void verbosity_set_log_level(unsigned level)
|
||||
{
|
||||
verbosity_log_level = level;
|
||||
}
|
||||
|
||||
void verbosity_enable(void)
|
||||
{
|
||||
main_verbosity = true;
|
||||
@ -161,6 +173,8 @@ void retro_main_log_file_deinit(void)
|
||||
|
||||
#if !defined(HAVE_LOGGER)
|
||||
void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
|
||||
{
|
||||
if (verbosity_log_level <= 1)
|
||||
{
|
||||
#if TARGET_OS_IPHONE
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
@ -269,6 +283,7 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void RARCH_LOG_BUFFER(uint8_t *data, size_t size)
|
||||
{
|
||||
@ -309,6 +324,8 @@ void RARCH_LOG(const char *fmt, ...)
|
||||
|
||||
if (!main_verbosity)
|
||||
return;
|
||||
if (verbosity_log_level > 1)
|
||||
return;
|
||||
|
||||
va_start(ap, fmt);
|
||||
RARCH_LOG_V(file_path_str(FILE_PATH_LOG_INFO), fmt, ap);
|
||||
@ -329,6 +346,8 @@ void RARCH_WARN(const char *fmt, ...)
|
||||
|
||||
if (!main_verbosity)
|
||||
return;
|
||||
if (verbosity_log_level > 2)
|
||||
return;
|
||||
|
||||
va_start(ap, fmt);
|
||||
RARCH_WARN_V(file_path_str(FILE_PATH_LOG_WARN), fmt, ap);
|
||||
|
@ -33,6 +33,8 @@ void verbosity_enable(void);
|
||||
|
||||
void verbosity_disable(void);
|
||||
|
||||
void verbosity_set_log_level(unsigned level);
|
||||
|
||||
bool *verbosity_get_ptr(void);
|
||||
|
||||
void *retro_main_log_file(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user