mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2026-04-23 10:08:03 -05:00
chore: Improve log output, include config path
Summary: Test Plan:
This commit is contained in:
parent
5531726fc2
commit
c3835118b1
|
|
@ -9,7 +9,7 @@ void bt_core_config_ext_s8_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_s8_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_u8_get(
|
||||
|
|
@ -18,7 +18,7 @@ void bt_core_config_ext_u8_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_u8_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_s16_get(
|
||||
|
|
@ -27,7 +27,7 @@ void bt_core_config_ext_s16_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_s16_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_u16_get(
|
||||
|
|
@ -36,7 +36,7 @@ void bt_core_config_ext_u16_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_u16_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_s32_get(
|
||||
|
|
@ -45,7 +45,7 @@ void bt_core_config_ext_s32_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_s32_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_u32_get(
|
||||
|
|
@ -54,7 +54,7 @@ void bt_core_config_ext_u32_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_u32_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_s64_get(
|
||||
|
|
@ -63,7 +63,7 @@ void bt_core_config_ext_s64_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_s64_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_u64_get(
|
||||
|
|
@ -72,7 +72,7 @@ void bt_core_config_ext_u64_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_u64_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_float_get(
|
||||
|
|
@ -81,7 +81,7 @@ void bt_core_config_ext_float_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_float_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_double_get(
|
||||
|
|
@ -90,7 +90,7 @@ void bt_core_config_ext_double_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_double_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_bool_get(
|
||||
|
|
@ -99,7 +99,7 @@ void bt_core_config_ext_bool_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_bool_get(config, path, value);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_bin_get(
|
||||
|
|
@ -108,7 +108,7 @@ void bt_core_config_ext_bin_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_bin_get(config, path, value, len);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_str_get(
|
||||
|
|
@ -117,14 +117,14 @@ void bt_core_config_ext_str_get(
|
|||
bt_core_config_result_t result;
|
||||
|
||||
result = bt_core_config_str_get(config, path, value, len);
|
||||
bt_core_config_fatal_on_error(result);
|
||||
bt_core_config_fatal_on_error(result, path);
|
||||
}
|
||||
|
||||
void bt_core_config_ext_net_addr_get(const bt_core_config_t *config, const char *path, struct net_addr *addr)
|
||||
{
|
||||
char buffer[1024];
|
||||
|
||||
bt_core_config_ext_str_get(config, "server", buffer, sizeof(buffer));
|
||||
bt_core_config_ext_str_get(config, path, buffer, sizeof(buffer));
|
||||
|
||||
if (!net_str_parse(buffer, addr)) {
|
||||
log_fatal("Cannot parse server address: %s", buffer);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ const char *bt_core_config_result_to_str(bt_core_config_result_t result)
|
|||
}
|
||||
}
|
||||
|
||||
void bt_core_config_fatal_on_error(bt_core_config_result_t result)
|
||||
void bt_core_config_fatal_on_error(bt_core_config_result_t result, const char *path)
|
||||
{
|
||||
switch (result) {
|
||||
case BT_CORE_CONFIG_RESULT_SUCCESS:
|
||||
|
|
@ -94,7 +94,7 @@ void bt_core_config_fatal_on_error(bt_core_config_result_t result)
|
|||
case BT_CORE_CONFIG_RESULT_TYPE_MISMATCH:
|
||||
default:
|
||||
log_fatal(
|
||||
"Operation on config failed: %s",
|
||||
"Operation on config for path \"%s\" failed: %s", path,
|
||||
bt_core_config_result_to_str(result));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ void bt_core_config_api_get(bt_core_config_api_t *api);
|
|||
void bt_core_config_api_clear();
|
||||
|
||||
const char *bt_core_config_result_to_str(bt_core_config_result_t result);
|
||||
void bt_core_config_fatal_on_error(bt_core_config_result_t result);
|
||||
void bt_core_config_fatal_on_error(bt_core_config_result_t result, const char *path);
|
||||
|
||||
bt_core_config_result_t bt_core_config_s8_get(
|
||||
const bt_core_config_t *config, const char *path, int8_t *value);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user