Refactor: Logging: Move G.quiet to CLOG, replace some printfs

* Replace G.quiet by CLG_quiet_set/get
* CLOG_INFO_NOCHECK prints are now suppressed when quiet, these were
  typically inside a if (!G.quiet) conditional already.
* Change some prints for blend files, color management and rendering to
  use CLOG, that were previously using if (!G.quiet) printf().

Pull Request: https://projects.blender.org/blender/blender/pulls/143138
This commit is contained in:
Brecht Van Lommel
2025-07-28 13:36:13 +02:00
committed by Brecht Van Lommel
parent b1d5c35f3a
commit fa007002b1
15 changed files with 121 additions and 139 deletions

View File

@@ -39,9 +39,10 @@
#include "MEM_guardedalloc.h"
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_report.hh"
#include "CLG_log.h"
/* so operators called can spawn threads which acquire the GIL */
#define BPY_RELEASE_GIL
@@ -257,7 +258,7 @@ static PyObject *pyop_call(PyObject * /*self*/, PyObject *args)
if (!BLI_listbase_is_empty(&reports->list)) {
/* Restore the print level as this is owned by the operator now. */
eReportType level = eReportType(reports->printlevel);
BKE_report_print_level_set(reports, G.quiet ? RPT_WARNING : RPT_DEBUG);
BKE_report_print_level_set(reports, CLG_quiet_get() ? RPT_WARNING : RPT_DEBUG);
BPy_reports_write_stdout(reports, nullptr);
BKE_report_print_level_set(reports, level);
}

View File

@@ -10172,7 +10172,7 @@ static PyObject *pyrna_register_class(PyObject * /*self*/, PyObject *py_class)
if (!BLI_listbase_is_empty(&reports.list)) {
const bool has_error = (BPy_reports_to_error(&reports, PyExc_RuntimeError, false) == -1);
if (!has_error) {
BKE_report_print_level_set(&reports, G.quiet ? RPT_WARNING : RPT_DEBUG);
BKE_report_print_level_set(&reports, CLG_quiet_get() ? RPT_WARNING : RPT_DEBUG);
BPy_reports_write_stdout(&reports, error_prefix);
}
if (has_error) {

View File

@@ -50,6 +50,8 @@
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"
#include "CLG_log.h"
/* for keyframes and drivers */
static int pyrna_struct_anim_args_parse_ex(PointerRNA *ptr,
const char *error_prefix,
@@ -436,7 +438,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
BKE_reports_free(&reports);
return nullptr;
}
BKE_report_print_level_set(&reports, G.quiet ? RPT_WARNING : RPT_DEBUG);
BKE_report_print_level_set(&reports, CLG_quiet_get() ? RPT_WARNING : RPT_DEBUG);
BPy_reports_write_stdout(&reports, nullptr);
BKE_reports_free(&reports);