Merge pull request #10 from wolszews/modify-logging
Change cache/core printing style
This commit is contained in:
commit
e1f7cd3875
@ -420,7 +420,7 @@ static int _ocf_mngt_init_instance_add_cores(
|
|||||||
if (!cache->core_obj[i].obj.type)
|
if (!cache->core_obj[i].obj.type)
|
||||||
goto _cache_mng_init_instance_add_cores_ERROR;
|
goto _cache_mng_init_instance_add_cores_ERROR;
|
||||||
|
|
||||||
ret = snprintf(core_name, sizeof(core_name), "%d", i);
|
ret = snprintf(core_name, sizeof(core_name), "core%d", i);
|
||||||
if (ret < 0 || ret >= sizeof(core_name))
|
if (ret < 0 || ret >= sizeof(core_name))
|
||||||
goto _cache_mng_init_instance_add_cores_ERROR;
|
goto _cache_mng_init_instance_add_cores_ERROR;
|
||||||
|
|
||||||
@ -716,7 +716,7 @@ static int _ocf_mngt_init_prepare_cache(struct ocf_cachemng_init_params *param,
|
|||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
ret = snprintf(cache_name, sizeof(cache_name),
|
ret = snprintf(cache_name, sizeof(cache_name),
|
||||||
"%hu", param->id);
|
"cache%hu", param->id);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -351,7 +351,7 @@ int ocf_mngt_cache_add_core_nolock(ocf_cache_t cache, ocf_core_t *core,
|
|||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
result = snprintf(core_name, sizeof(core_name), "%hu",
|
result = snprintf(core_name, sizeof(core_name), "core%hu",
|
||||||
cfg->core_id);
|
cfg->core_id);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return result;
|
return result;
|
||||||
|
@ -211,11 +211,11 @@ struct ocf_cache {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define ocf_cache_log_prefix(cache, lvl, prefix, fmt, ...) \
|
#define ocf_cache_log_prefix(cache, lvl, prefix, fmt, ...) \
|
||||||
ocf_log_prefix(ocf_cache_get_ctx(cache), lvl, "[Cache %s] ", \
|
ocf_log_prefix(ocf_cache_get_ctx(cache), lvl, "%s" prefix, \
|
||||||
prefix fmt, ocf_cache_get_name(cache), ##__VA_ARGS__)
|
fmt, ocf_cache_get_name(cache), ##__VA_ARGS__)
|
||||||
|
|
||||||
#define ocf_cache_log(cache, lvl, fmt, ...) \
|
#define ocf_cache_log(cache, lvl, fmt, ...) \
|
||||||
ocf_cache_log_prefix(cache, lvl, "", fmt, ##__VA_ARGS__)
|
ocf_cache_log_prefix(cache, lvl, ": ", fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
#define ocf_cache_log_rl(cache) \
|
#define ocf_cache_log_rl(cache) \
|
||||||
ocf_log_rl(ocf_cache_get_ctx(cache))
|
ocf_log_rl(ocf_cache_get_ctx(cache))
|
||||||
|
@ -47,10 +47,10 @@ bool ocf_core_is_valid(ocf_cache_t cache, ocf_core_id_t id);
|
|||||||
int ocf_core_set_user_metadata_raw(ocf_core_t core, void *data, size_t size);
|
int ocf_core_set_user_metadata_raw(ocf_core_t core, void *data, size_t size);
|
||||||
|
|
||||||
#define ocf_core_log_prefix(core, lvl, prefix, fmt, ...) \
|
#define ocf_core_log_prefix(core, lvl, prefix, fmt, ...) \
|
||||||
ocf_cache_log_prefix(ocf_core_get_cache(core), lvl, "[Core %s] ", \
|
ocf_cache_log_prefix(ocf_core_get_cache(core), lvl, ".%s" prefix, \
|
||||||
prefix fmt, ocf_core_get_name(core), ##__VA_ARGS__)
|
fmt, ocf_core_get_name(core), ##__VA_ARGS__)
|
||||||
|
|
||||||
#define ocf_core_log(core, lvl, fmt, ...) \
|
#define ocf_core_log(core, lvl, fmt, ...) \
|
||||||
ocf_core_log_prefix(core, lvl, "", fmt, ##__VA_ARGS__)
|
ocf_core_log_prefix(core, lvl, ": ", fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
#endif /* __OCF_CORE_PRIV_H__ */
|
#endif /* __OCF_CORE_PRIV_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user