[Bf-blender-cvs] [c766df20339] soc-2020-info-editor: Add verbose log severity
Mateusz GrzeliÅski
noreply at git.blender.org
Wed Jul 8 15:14:47 CEST 2020
Commit: c766df20339ef4a768c3b5e2af91cbd35825e98c
Author: Mateusz Grzeliński
Date: Wed Jul 8 10:45:27 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rBc766df20339ef4a768c3b5e2af91cbd35825e98c
Add verbose log severity
- it is common practice to have separated info and verbose log
- verbose log is always with code
- convert LOG_INFO with level higher than 1 to LOG_VERBOSE
===================================================================
M intern/clog/CLG_log.h
M intern/clog/clog.c
M source/blender/blenfont/intern/blf.c
M source/blender/blenfont/intern/blf_font.c
M source/blender/blenfont/intern/blf_thumbs.c
M source/blender/blenkernel/intern/DerivedMesh.c
M source/blender/blenkernel/intern/anim_data.c
M source/blender/blenkernel/intern/anim_sys.c
M source/blender/blenkernel/intern/appdir.c
M source/blender/blenkernel/intern/blendfile.c
M source/blender/blenkernel/intern/brush.c
M source/blender/blenkernel/intern/cloth.c
M source/blender/blenkernel/intern/constraint.c
M source/blender/blenkernel/intern/curveprofile.c
M source/blender/blenkernel/intern/dynamicpaint.c
M source/blender/blenkernel/intern/fcurve.c
M source/blender/blenkernel/intern/image.c
M source/blender/blenkernel/intern/mesh_evaluate.c
M source/blender/blenkernel/intern/mesh_remap.c
M source/blender/blenkernel/intern/mesh_runtime.c
M source/blender/blenkernel/intern/mesh_validate.c
M source/blender/blenkernel/intern/undo_system.c
M source/blender/blenkernel/intern/volume.cc
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/versioning_250.c
M source/blender/blenloader/intern/versioning_legacy.c
M source/blender/editors/animation/anim_motion_paths.c
M source/blender/editors/undo/ed_undo.c
M source/blender/io/alembic/exporter/abc_export_capi.cc
M source/blender/io/alembic/exporter/abc_writer_camera.cc
M source/blender/io/alembic/exporter/abc_writer_curves.cc
M source/blender/io/alembic/exporter/abc_writer_hair.cc
M source/blender/io/alembic/exporter/abc_writer_mesh.cc
M source/blender/io/alembic/exporter/abc_writer_nurbs.cc
M source/blender/io/alembic/exporter/abc_writer_points.cc
M source/blender/io/alembic/exporter/abc_writer_transform.cc
M source/blender/python/intern/bpy_interface.c
M source/blender/python/intern/bpy_msgbus.c
M source/blender/python/intern/bpy_rna.c
M source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
M source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
M source/blender/windowmanager/intern/wm_event_query.c
M source/blender/windowmanager/intern/wm_event_system.c
M source/blender/windowmanager/intern/wm_files.c
M source/blender/windowmanager/intern/wm_files_link.c
M source/blender/windowmanager/intern/wm_gesture.c
M source/blender/windowmanager/intern/wm_gesture_ops.c
M source/blender/windowmanager/intern/wm_init_exit.c
M source/blender/windowmanager/intern/wm_jobs.c
M source/blender/windowmanager/intern/wm_keymap.c
M source/blender/windowmanager/intern/wm_menu_type.c
M source/blender/windowmanager/intern/wm_operator_type.c
M source/blender/windowmanager/intern/wm_operators.c
M source/blender/windowmanager/intern/wm_panel_type.c
M source/blender/windowmanager/intern/wm_platform_support.c
M source/blender/windowmanager/intern/wm_uilist_type.c
M source/blender/windowmanager/intern/wm_window.c
M source/blender/windowmanager/message_bus/intern/wm_message_bus.c
M source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c
M source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c
===================================================================
diff --git a/intern/clog/CLG_log.h b/intern/clog/CLG_log.h
index f9ef05fd99e..537231313ab 100644
--- a/intern/clog/CLG_log.h
+++ b/intern/clog/CLG_log.h
@@ -101,7 +101,8 @@ enum CLG_LogFlag {
};
enum CLG_Severity {
- CLG_SEVERITY_INFO = 0,
+ CLG_SEVERITY_VERBOSE = 0,
+ CLG_SEVERITY_INFO,
CLG_SEVERITY_WARN,
CLG_SEVERITY_ERROR,
CLG_SEVERITY_FATAL,
@@ -227,21 +228,25 @@ void CLG_logref_init(CLG_LogRef *clg_ref);
} \
((void)0)
-#define CLOG_INFO(clg_ref, level, ...) \
- CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_INFO, level, __VA_ARGS__)
+/* if needed INFO_DEBUG can be added, which should by available only in debug build */
+#define CLOG_VERBOSE(clg_ref, level, ...) \
+ CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_VERBOSE, level, __VA_ARGS__)
+#define CLOG_INFO(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_INFO, 0, __VA_ARGS__)
#define CLOG_WARN(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_WARN, 0, __VA_ARGS__)
#define CLOG_ERROR(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_ERROR, 0, __VA_ARGS__)
#define CLOG_FATAL(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_FATAL, 0, __VA_ARGS__)
-#define CLOG_STR_INFO(clg_ref, level, str) \
- CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_INFO, level, str)
+#define CLOG_STR_VERBOSE(clg_ref, level, str) \
+ CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_VERBOSE, level, str)
+#define CLOG_STR_INFO(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_INFO, 0, str)
#define CLOG_STR_WARN(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_WARN, 0, str)
#define CLOG_STR_ERROR(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_ERROR, 0, str)
#define CLOG_STR_FATAL(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_FATAL, 0, str)
/* Allocated string which is immediately freed. */
-#define CLOG_STR_INFO_N(clg_ref, level, str) \
- CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_INFO, level, str)
+#define CLOG_STR_VERBOSE_N(clg_ref, level, str) \
+ CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_VERBOSE, level, str)
+#define CLOG_STR_INFO_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_INFO, 0, str)
#define CLOG_STR_WARN_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_WARN, 0, str)
#define CLOG_STR_ERROR_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_ERROR, 0, str)
#define CLOG_STR_FATAL_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_FATAL, 0, str)
diff --git a/intern/clog/clog.c b/intern/clog/clog.c
index dad1206cd52..1507d452481 100644
--- a/intern/clog/clog.c
+++ b/intern/clog/clog.c
@@ -243,6 +243,7 @@ static void clg_color_table_init(bool use_color)
}
static const char *clg_severity_str[CLG_SEVERITY_LEN] = {
+ [CLG_SEVERITY_VERBOSE] = "VERBOSE",
[CLG_SEVERITY_INFO] = "INFO",
[CLG_SEVERITY_WARN] = "WARN",
[CLG_SEVERITY_ERROR] = "ERROR",
@@ -266,6 +267,9 @@ static enum eCLogColor clg_severity_to_color(enum CLG_Severity severity)
assert((unsigned int)severity < CLG_SEVERITY_LEN);
enum eCLogColor color = COLOR_DEFAULT;
switch (severity) {
+ case CLG_SEVERITY_VERBOSE:
+ color = COLOR_DEFAULT;
+ break;
case CLG_SEVERITY_INFO:
color = COLOR_DEFAULT;
break;
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index bd78d7951d4..197f98d20d4 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -1004,7 +1004,6 @@ void BLF_draw_buffer(int fontid, const char *str, size_t len)
BLF_draw_buffer_ex(fontid, str, len, NULL);
}
-/* example usage: CLOG_STR_INFO_N(BLENFONT_LOG, 2, BLF_state_sprintN(font_id)); */
char *BLF_state_sprintN(int fontid)
{
DynStr *message = BLI_dynstr_new();
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 99652e7d063..30343e0102a 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -971,7 +971,7 @@ static void blf_font_wrap_apply(FontBLF *font,
size_t start, last[2];
} wrap = {font->wrap_width != -1 ? font->wrap_width : INT_MAX, 0, {0, 0}};
- CLOG_INFO(BLENFONT_LOG, 2, "wrapping (%zu, %zu) `%s`:", len, strlen(str), str);
+ CLOG_VERBOSE(BLENFONT_LOG, 2, "wrapping (%zu, %zu) `%s`:", len, strlen(str), str);
while ((i < len) && str[i]) {
/* wrap vars */
@@ -1019,13 +1019,13 @@ static void blf_font_wrap_apply(FontBLF *font,
}
if (UNLIKELY(do_draw)) {
- CLOG_INFO(BLENFONT_LOG,
- 2,
- "(%03zu..%03zu) `%lu %s`",
- wrap.start,
- wrap.last[0],
- (wrap.last[0] - wrap.start) - 1,
- &str[wrap.start]);
+ CLOG_VERBOSE(BLENFONT_LOG,
+ 2,
+ "(%03zu..%03zu) `%lu %s`",
+ wrap.start,
+ wrap.last[0],
+ (wrap.last[0] - wrap.start) - 1,
+ &str[wrap.start]);
callback(font, gc, &str[wrap.start], (wrap.last[0] - wrap.start) - 1, pen_y, userdata);
wrap.start = wrap.last[0];
@@ -1041,7 +1041,7 @@ static void blf_font_wrap_apply(FontBLF *font,
g_prev = g;
}
- CLOG_INFO(BLENFONT_LOG, 2, "done! lines: %d, width, %d", lines, pen_x_next);
+ CLOG_VERBOSE(BLENFONT_LOG, 2, "done! lines: %d, width, %d", lines, pen_x_next);
if (r_info) {
r_info->lines = lines;
diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c
index c042144c628..dd489d7fc46 100644
--- a/source/blender/blenfont/intern/blf_thumbs.c
+++ b/source/blender/blenfont/intern/blf_thumbs.c
@@ -73,7 +73,7 @@ void BLF_thumb_preview(const char *filename,
/* Create a new blender font obj and fill it with default values */
font = blf_font_new("thumb_font", filename);
if (!font) {
- CLOG_INFO(BLENFONT_LOG, 0, "Can't load font '%s', no preview possible", filename);
+ CLOG_INFO(BLENFONT_LOG, "Can't load font '%s', no preview possible", filename);
return;
}
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index e80a6fd93f2..d4083d56498 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2350,7 +2350,7 @@ char *DM_debug_sprintfN(DerivedMesh *dm)
return ret;
}
-/** better use CLOG_STR_INFO_N(&LOG, 1, DM_debug_sprintfN(dm)); */
+/** better use CLOG */
void DM_debug_print(DerivedMesh *dm)
{
char *str = DM_debug_sprintfN(dm);
diff --git a/source/blender/blenkernel/intern/anim_data.c b/source/blender/blenkernel/intern/anim_data.c
index a74998cec31..06ae45a28cd 100644
--- a/source/blender/blenkernel/intern/anim_data.c
+++ b/source/blender/blenkernel/intern/anim_data.c
@@ -946,9 +946,9 @@ char *BKE_animsys_fix_rna_path_rename(ID *owner_id,
}
/* fix given path */
- CLOG_INFO(&LOG, 3, "%s | %s | oldpath = %p ", oldN, newN, old_path);
+ CLOG_VERBOSE(&LOG, 3, "%s | %s | oldpath = %p ", oldN, newN, old_path);
result = rna_path_rename_fix(owner_id, prefix, oldN, newN, old_path, verify_paths);
- CLOG_INFO(&LOG, 3, "path rename result = %p\n", result);
+ CLOG_VERBOSE(&LOG, 3, "path rename result = %p\n", result);
/* free the temp names */
MEM_freeN(oldN);
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index e5a7c74955c..6eb5e7c7c2f 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -2544,7 +2544,7 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, float
{
ID *id;
- CLOG_INFO(&LOG, 3, "Evaluate all animation - %f", ctime);
+ CLOG_VERBOSE(&LOG, 3, "Evaluate all animation - %f", ctime);
const bool flush_to_original = DEG_is_active(depsgraph);
@@ -2592,7 +2592,7 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, float
* set correctly, so this optimization must be skipped in that case...
*/
if (BLI_listbase_is_empty(&main->actions) && BLI_listbase_is_empty(&main->curves)) {
- CLOG_INFO(&LOG, 3, "\tNo Actions, so no animation needs to be evaluated...");
+ CLOG_VERBOSE(&LOG, 3, "\tNo Actions, so no animation needs to be evaluated...");
return;
}
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 78d512a16ff..c7ef67b1834 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -147,11 +147,11 @@ static bool test_path(char *targetpath,
* if folder_name is specified but not otherwise? */
if (BLI_is_dir(targetpath)) {
- CLOG_INFO(&LOG, 1, "\tfound: %s", targetpath);
+ CLOG_VERBOSE(&LOG, 1, "\tfound: %s", targetpath);
return true;
}
- CLOG_INFO(&LOG, 1, "\tmissing: %s", targetpath);
+ CLOG_VERBOSE(&LOG, 1, "\tmissing: %s", targetpath);
// targetpath[0] = '\0';
return false;
}
@@ -169,12 +169,12 @@ static bool test_env_path(char *path, const char *envvar)
if (BLI_is_dir(env)) {
BLI_strncpy(path, env, FILE_MAX);
- CLOG_INFO(&LOG, 1, "\tenv %s found: %s", envvar, env);
+ CLOG_VERBOSE(&LOG, 1, "\tenv %s found: %s", envvar, env);
return true;
}
path[0] = '\0';
- CLOG_INFO(&LOG, 1, "\tenv %s missing: %s", envvar, env);
+ CLOG_VERBOSE(&LOG, 1, "\tenv %s missing: %s", envvar, env);
return false;
}
@@ -320,7 +320,7 @@ static bool get_path_user(char *targetpath,
return false;
}
- CLOG_INFO(&LOG, 4, "user_path: %s", user_path);
+ CLOG_VERBOSE(&LOG, 4, "user_path: %s", user_path);
if (subfolder_name) {
return test_path(targetpath, targetpath_len, user_path, folder_name, subfolder_name);
@@ -370,7 +370,7 @@ static bool get_path_system(char *targetpath,
return false;
}
- CLOG_INFO(&LOG, 3, "%s", system_path);
+ CLOG_VERBOSE(&LOG, 3, "%s", system_path);
if (subfolder_name) {
/* try $BLENDERPATH/folder_name/subfolder_name */
@@ -676,7 +676,7 @@ static void where_am_i(char *fullname, const size_t maxlen, const char *name)
BLI_path_normalize(NULL, fullname);
if (!STREQ(name, fullname)) {
- CLOG_INFO(&LOG, 2, "guessing '%s'
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list