Logging: use for Python API

Adds categories "bpy.context" & "bpy.rna"
This commit is contained in:
2018-04-02 11:05:15 +02:00
parent 21fcc723e9
commit 017c731cf3
7 changed files with 115 additions and 36 deletions

View File

@@ -33,6 +33,8 @@
#include "MEM_guardedalloc.h"
#include "CLG_log.h"
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_fileops.h"
@@ -75,6 +77,9 @@
#include "../bmesh/bmesh_py_api.h"
#include "../mathutils/mathutils.h"
/* Logging types to use anywhere in the Python modules. */
CLG_LOGREF_DECLARE_GLOBAL(BPY_LOG_CONTEXT, "bpy.context");
CLG_LOGREF_DECLARE_GLOBAL(BPY_LOG_RNA, "bpy.rna");
/* for internal use, when starting and ending python scripts */
@@ -800,8 +805,9 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
CTX_data_list_add(result, ptr->id.data, ptr->type, ptr->data);
}
else {
printf("PyContext: '%s' list item not a valid type in sequece type '%s'\n",
member, Py_TYPE(item)->tp_name);
CLOG_INFO(BPY_LOG_CONTEXT, 1,
"'%s' list item not a valid type in sequence type '%s'",
member, Py_TYPE(item)->tp_name);
}
}
@@ -813,16 +819,14 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
if (done == false) {
if (item) {
printf("PyContext '%s' not a valid type\n", member);
CLOG_INFO(BPY_LOG_CONTEXT, 1, "'%s' not a valid type", member);
}
else {
printf("PyContext '%s' not found\n", member);
CLOG_INFO(BPY_LOG_CONTEXT, 1, "'%s' not found\n", member);
}
}
else {
if (G.debug & G_DEBUG_PYTHON) {
printf("PyContext '%s' found\n", member);
}
CLOG_INFO(BPY_LOG_CONTEXT, 2, "'%s' found", member);
}
if (use_gil)