[Bf-blender-cvs] [3987b14c894] soc-2020-info-editor: Tweaks to logging
Mateusz GrzeliÅski
noreply at git.blender.org
Wed Jul 1 12:43:47 CEST 2020
Commit: 3987b14c894d80520f6ef1a29b40a7731cf96ef7
Author: Mateusz Grzeliński
Date: Wed Jul 1 12:40:24 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rB3987b14c894d80520f6ef1a29b40a7731cf96ef7
Tweaks to logging
- use generally higher verbosity
- remove clog which was only showcase
- remove ifdef debug guards
- rename print function to match general style
===================================================================
M source/blender/blenkernel/BKE_idprop.h
M source/blender/blenkernel/intern/idprop_utils.c
M source/blender/windowmanager/intern/wm_files_link.c
M source/blender/windowmanager/intern/wm_gesture.c
M source/blender/windowmanager/intern/wm_keymap.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 745c1edabf0..8f8d930a513 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -196,7 +196,7 @@ void IDP_repr_fn(const IDProperty *prop,
void (*str_append_fn)(void *user_data, const char *str, uint str_len),
void *user_data);
void IDP_print(const struct IDProperty *prop);
-char *IDP_print_str(const IDProperty *prop);
+char *IDP_sprintN(const IDProperty *prop);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/intern/idprop_utils.c b/source/blender/blenkernel/intern/idprop_utils.c
index 1ff87b190a5..f8260b2a4a9 100644
--- a/source/blender/blenkernel/intern/idprop_utils.c
+++ b/source/blender/blenkernel/intern/idprop_utils.c
@@ -241,16 +241,12 @@ void IDP_print(const IDProperty *prop)
MEM_freeN(repr);
}
-char *IDP_print_str(const IDProperty *prop)
+char *IDP_sprintN(const IDProperty *prop)
{
- DynStr *ds = BLI_dynstr_new();
char *repr = IDP_reprN(prop, NULL);
- BLI_dynstr_appendf(ds, "IDProperty(%p): %s", prop, repr);
+ char *cstring = BLI_sprintfN("IDProperty(%p): %s", prop, repr);
MEM_freeN(repr);
- char *cstring = BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
return cstring;
}
-
/** \} */
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index c00a3230d0a..e3b4982470e 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -786,7 +786,7 @@ static void lib_relocate_do(Main *bmain,
}
if (new_id) {
CLOG_INFO(WM_LOG_OPERATORS,
- 1,
+ 3,
"before remap of %s, old_id users: %d, new_id users: %d",
old_id->name,
old_id->us,
@@ -799,7 +799,7 @@ static void lib_relocate_do(Main *bmain,
}
CLOG_INFO(WM_LOG_OPERATORS,
- 1,
+ 3,
"after remap of %s, old_id users: %d, new_id users: %d",
old_id->name,
old_id->us,
@@ -993,8 +993,8 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload)
if (BLI_path_cmp(lib->filepath_abs, path) == 0) {
CLOG_INFO(WM_LOG_OPERATORS,
- 0,
- "We are supposed to reload '%s' lib (%d)...\n",
+ 2,
+ "We are supposed to reload '%s' lib (%d)...",
lib->filepath,
lib->id.us);
@@ -1037,14 +1037,13 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload)
}
CLOG_INFO(
- WM_LOG_OPERATORS, 1, "\t candidate new lib to reload datablocks from: %s\n", path);
+ WM_LOG_OPERATORS, 3, "\t candidate new lib to reload datablocks from: %s", path);
wm_link_append_data_library_add(lapp_data, path);
}
RNA_END;
}
else {
- CLOG_INFO(
- WM_LOG_OPERATORS, 1, "\t candidate new lib to reload datablocks from: %s\n", path);
+ CLOG_INFO(WM_LOG_OPERATORS, 3, "\t candidate new lib to reload datablocks from: %s", path);
wm_link_append_data_library_add(lapp_data, path);
}
}
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index d2f47140c70..a4cada5119e 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -165,33 +165,31 @@ int wm_gesture_evaluate(wmGesture *gesture, const wmEvent *event)
val = EVT_GESTURE_SW;
}
-#if 0
/* debug */
if (val == 1) {
- CLOG_INFO(WM_LOG_EVENTS, 2, "tweak north");
+ CLOG_INFO(WM_LOG_EVENTS, 5, "tweak north");
}
- if (val == 2) {
- CLOG_INFO(WM_LOG_EVENTS, 2, "tweak north-east");
+ else if (val == 2) {
+ CLOG_INFO(WM_LOG_EVENTS, 5, "tweak north-east");
}
- if (val == 3) {
- CLOG_INFO(WM_LOG_EVENTS, 2, "tweak east");
+ else if (val == 3) {
+ CLOG_INFO(WM_LOG_EVENTS, 5, "tweak east");
}
- if (val == 4) {
- CLOG_INFO(WM_LOG_EVENTS, 2, "tweak south-east");
+ else if (val == 4) {
+ CLOG_INFO(WM_LOG_EVENTS, 5, "tweak south-east");
}
- if (val == 5) {
- CLOG_INFO(WM_LOG_EVENTS, 2, "tweak south");
+ else if (val == 5) {
+ CLOG_INFO(WM_LOG_EVENTS, 5, "tweak south");
}
- if (val == 6) {
- CLOG_INFO(WM_LOG_EVENTS, 2, "tweak south-west");
+ else if (val == 6) {
+ CLOG_INFO(WM_LOG_EVENTS, 5, "tweak south-west");
}
- if (val == 7) {
- CLOG_INFO(WM_LOG_EVENTS, 2, "tweak west");
+ else if (val == 7) {
+ CLOG_INFO(WM_LOG_EVENTS, 5, "tweak west");
}
- if (val == 8) {
- CLOG_INFO(WM_LOG_EVENTS, 2, "tweak north-west");
+ else if (val == 8) {
+ CLOG_INFO(WM_LOG_EVENTS, 5, "tweak north-west");
}
-#endif
return val;
}
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index d88cb7cf0a5..06392f83589 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -1339,16 +1339,6 @@ static wmKeyMapItem *wm_keymap_item_find_in_keymap(wmKeyMap *keymap,
if (STREQ(kmi->idname, opname)) {
if (properties) {
- /* example of debugging keymaps */
-#if 0
- if (kmi->ptr) {
- if (STREQ("MESH_OT_rip_move", opname)) {
- // todo does IDP_print_str leak memory in this usagenk?
- CLOG_INFO(WM_LOG_KEYMAPS, 0, "OPERATOR: %s", IDP_print_str(properties));
- CLOG_INFO(WM_LOG_KEYMAPS, 0, "KEYMAP: %s", IDP_print_str(kmi->ptr->data));
- }
- }
-#endif
if (kmi->ptr && IDP_EqualsProperties_ex(properties, kmi->ptr->data, is_strict)) {
kmi_match = true;
@@ -1376,11 +1366,13 @@ static wmKeyMapItem *wm_keymap_item_find_in_keymap(wmKeyMap *keymap,
opname,
keymap->idname,
kmi_str);
-#ifndef NDEBUG
-# ifdef WITH_PYTHON
- CLOG_INFO(WM_LOG_KEYMAPS, 0, "OPERATOR: %s", IDP_print_str(properties));
- CLOG_INFO(WM_LOG_KEYMAPS, 0, "KEYMAP: %s", IDP_print_str(kmi->ptr->data));
-# endif
+#ifdef WITH_PYTHON
+ char *operator_str = IDP_sprintN(properties);
+ CLOG_INFO(WM_LOG_KEYMAPS, 4, "OPERATOR: %s", operator_str);
+ MEM_freeN(operator_str);
+ char *keymap_str = IDP_sprintN(kmi->ptr->data);
+ CLOG_INFO(WM_LOG_KEYMAPS, 4, "KEYMAP: %s", keymap_str);
+ MEM_freeN(keymap_str);
#endif
}
@@ -1586,11 +1578,13 @@ static wmKeyMapItem *wm_keymap_item_find(const bContext *C,
opname,
km->idname,
kmi_str);
-#ifndef NDEBUG
-# ifdef WITH_PYTHON
- CLOG_INFO(WM_LOG_KEYMAPS, 0, "OPERATOR: %s", IDP_print_str(properties));
- CLOG_INFO(WM_LOG_KEYMAPS, 0, "KEYMAP: %s", IDP_print_str(kmi->ptr->data));
-# endif
+#ifdef WITH_PYTHON
+ char *operator_str = IDP_sprintN(properties);
+ CLOG_INFO(WM_LOG_KEYMAPS, 4, "OPERATOR: %s", operator_str);
+ MEM_freeN(operator_str);
+ char *keymap_str = IDP_sprintN(kmi->ptr->data);
+ CLOG_INFO(WM_LOG_KEYMAPS, 4, "KEYMAP: %s", keymap_str);
+ MEM_freeN(keymap_str);
#endif
}
More information about the Bf-blender-cvs
mailing list