Clean up main logging function
This commit is contained in:
+9
-12
@@ -547,22 +547,14 @@ void uc_logf(int log_level, int module, int raw,
|
||||
{
|
||||
va_list ap;
|
||||
struct uc_log_destination *dest;
|
||||
const struct uc_log_module *log_module;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
pthread_mutex_lock(&g_log_lock);
|
||||
|
||||
//Find the module doign the logging, or use the unknown module -
|
||||
//the latter would indicate a bug somewhere in the application as it should
|
||||
//always specify a known module
|
||||
if (module >= 0 && module < g_modules.cnt)
|
||||
log_module = &g_modules.mods[module];
|
||||
else
|
||||
log_module = &g_unknown_module;
|
||||
|
||||
//do logging for each destination
|
||||
SLIST_FOREACH(dest, &g_destinations, entry) {
|
||||
const struct uc_log_module *log_module;
|
||||
va_list apc;
|
||||
int module_log_level;
|
||||
|
||||
@@ -571,11 +563,16 @@ void uc_logf(int log_level, int module, int raw,
|
||||
if (log_level < dest->log_level)
|
||||
continue;
|
||||
|
||||
//individual module level
|
||||
if (module >= 0 && module < g_modules.cnt)
|
||||
//Find the module doing the logging, or use the unknown module -
|
||||
//the latter would indicate a bug somewhere in the application as it should
|
||||
//always specify a known module
|
||||
if (module >= 0 && module < g_modules.cnt) {
|
||||
module_log_level = dest->module_settings[module].log_level;
|
||||
else //application bug. use global/unknown module
|
||||
log_module = &g_modules.mods[module];
|
||||
} else {
|
||||
log_module = &g_unknown_module;
|
||||
module_log_level = log_module->log_level;
|
||||
}
|
||||
|
||||
if (log_level < module_log_level)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user