Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-04-02 12:05:15 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-02 14:13:57 +0300
commit017c731cf38b01e6ffd2d57932c3a268678e51eb (patch)
tree0536e9d5f911c23828de6179d1f3bf0d5cd76789 /source/blender/python/intern/bpy_interface.c
parent21fcc723e98b81f77c46edb18c5092d8878c6ccb (diff)
Logging: use for Python API
Adds categories "bpy.context" & "bpy.rna"
Diffstat (limited to 'source/blender/python/intern/bpy_interface.c')
-rw-r--r--source/blender/python/intern/bpy_interface.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index ae8e35ae3fc..99f87c61c5a 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -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)