diff --git a/intern/ghost/intern/GHOST_ContextVK.cc b/intern/ghost/intern/GHOST_ContextVK.cc index b653986a23e..67bd24faf18 100644 --- a/intern/ghost/intern/GHOST_ContextVK.cc +++ b/intern/ghost/intern/GHOST_ContextVK.cc @@ -39,7 +39,7 @@ using namespace std; -static CLG_LogRef LOG = {"ghost.vulkan"}; +static CLG_LogRef LOG = {"ghost.context"}; static const char *vulkan_error_as_string(VkResult result) { @@ -96,8 +96,10 @@ static const char *vulkan_error_as_string(VkResult result) do { \ VkResult r = (__expression); \ if (r != VK_SUCCESS) { \ - CLOG_ERROR( \ - &LOG, "%s resulted in code %s.", __STR(__expression), vulkan_error_as_string(r)); \ + CLOG_ERROR(&LOG, \ + "Vulkan: %s resulted in code %s.", \ + __STR(__expression), \ + vulkan_error_as_string(r)); \ return GHOST_kFailure; \ } \ } while (0) @@ -250,11 +252,11 @@ class GHOST_DeviceVK { for (const char *optional_extension : optional_extensions) { const bool extension_found = has_extensions({optional_extension}); if (extension_found) { - CLOG_DEBUG(&LOG, "enable optional extension: `%s`", optional_extension); + CLOG_DEBUG(&LOG, "Vulkan: enable optional extension: `%s`", optional_extension); device_extensions.push_back(optional_extension); } else { - CLOG_DEBUG(&LOG, "optional extension not found: `%s`", optional_extension); + CLOG_DEBUG(&LOG, "Vulkan: optional extension not found: `%s`", optional_extension); } } @@ -527,7 +529,7 @@ static GHOST_TSuccess ensure_vulkan_device(VkInstance vk_instance, } if (best_physical_device == VK_NULL_HANDLE) { - CLOG_ERROR(&LOG, "Error: No suitable Vulkan Device found!"); + CLOG_ERROR(&LOG, "No suitable Vulkan Device found!"); return GHOST_kFailure; } @@ -668,7 +670,7 @@ GHOST_TSuccess GHOST_ContextVK::swapBuffers() recreateSwapchain(use_hdr_swapchain); } } - CLOG_DEBUG(&LOG, "render_frame=%lu, image_index=%u", m_render_frame, image_index); + CLOG_DEBUG(&LOG, "Vulkan: render_frame=%lu, image_index=%u", m_render_frame, image_index); GHOST_SwapchainImage &swapchain_image = m_swapchain_images[image_index]; GHOST_VulkanSwapChainData swap_chain_data; @@ -707,8 +709,9 @@ GHOST_TSuccess GHOST_ContextVK::swapBuffers() return GHOST_kSuccess; } if (present_result != VK_SUCCESS) { - CLOG_ERROR( - &LOG, "failed to present swap chain image : %s", vulkan_error_as_string(acquire_result)); + CLOG_ERROR(&LOG, + "Vulkan: failed to present swap chain image : %s", + vulkan_error_as_string(acquire_result)); } if (swap_buffers_post_callback_) { @@ -808,7 +811,7 @@ static void requireExtension(const vector &extensions_ava extensions_enabled.push_back(extension_name); } else { - CLOG_ERROR(&LOG, "required extension not found: %s", extension_name); + CLOG_ERROR(&LOG, "Vulkan: required extension not found: %s", extension_name); } } @@ -1090,7 +1093,7 @@ GHOST_TSuccess GHOST_ContextVK::recreateSwapchain(bool use_hdr_swapchain) m_swapchain_images[index].vk_image = swapchain_images[index]; } CLOG_DEBUG(&LOG, - "recreating swapchain: width=%u, height=%u, format=%d, colorSpace=%d, " + "Vulkan: recreating swapchain: width=%u, height=%u, format=%d, colorSpace=%d, " "present_mode=%d, image_count_requested=%u, image_count_acquired=%u, swapchain=%lx, " "old_swapchain=%lx", m_render_extent.width, diff --git a/intern/ghost/intern/GHOST_NDOFManager.cc b/intern/ghost/intern/GHOST_NDOFManager.cc index 73ed1326f9b..e10df93391f 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.cc +++ b/intern/ghost/intern/GHOST_NDOFManager.cc @@ -10,7 +10,6 @@ #include "GHOST_WindowManager.hh" #include "GHOST_utildefines.hh" -/* Logging, use `ghost.ndof.*` prefix. */ #include "CLG_log.h" #include @@ -20,6 +19,8 @@ #include /* For memory functions. */ #include +static CLG_LogRef LOG = {"ghost.ndof"}; + /** * 3Dconnexion keyboards and keypads use specific keys that have no standard equivalent. * These could be supported as generic "custom" keys, see !124155 review for details. @@ -235,9 +236,6 @@ GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys) /** \name NDOF Device Setup * \{ */ -static CLG_LogRef LOG_NDOF_DEVICE = {"ghost.ndof.device"}; -#define LOG (&LOG_NDOF_DEVICE) - bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id) { /* Call this function until it returns true @@ -307,7 +305,7 @@ bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id) break; } default: { - CLOG_DEBUG(LOG, "unknown Logitech product %04hx", product_id); + CLOG_INFO(&LOG, "Unknown Logitech product %04hx", product_id); } } break; @@ -349,29 +347,27 @@ bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id) break; } default: { - CLOG_DEBUG(LOG, "unknown 3Dconnexion product %04hx", product_id); + CLOG_INFO(&LOG, "Unknown 3Dconnexion product %04hx", product_id); } } break; default: - CLOG_DEBUG(LOG, "unknown device %04hx:%04hx", vendor_id, product_id); + CLOG_INFO(&LOG, "Unknown device %04hx:%04hx", vendor_id, product_id); } if (device_type_ != NDOF_UnknownDevice) { - CLOG_DEBUG(LOG, "using %s", ndof_device_names[device_type_]); + CLOG_INFO(&LOG, "Using %s", ndof_device_names[device_type_]); } if (hid_map_button_mask_ == 0) { hid_map_button_mask_ = int(~(UINT_MAX << hid_map_button_num_)); } - CLOG_DEBUG(LOG, "%d buttons -> hex:%X", hid_map_button_num_, uint(hid_map_button_mask_)); + CLOG_DEBUG(&LOG, "Device %d buttons -> hex:%X", hid_map_button_num_, uint(hid_map_button_mask_)); return device_type_ != NDOF_UnknownDevice; } -#undef LOG - /** \} */ /* -------------------------------------------------------------------- */ @@ -398,9 +394,6 @@ void GHOST_NDOFManager::updateRotation(const int r[3], uint64_t time) /** \name NDOF Buttons * \{ */ -static CLG_LogRef LOG_NDOF_BUTTONS = {"ghost.ndof.buttons"}; -#define LOG (&LOG_NDOF_BUTTONS) - static GHOST_TKey ghost_map_keyboard_from_ndof_button(const GHOST_NDOF_ButtonT button) { switch (button) { @@ -509,12 +502,16 @@ void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key, void GHOST_NDOFManager::updateButton(GHOST_NDOF_ButtonT button, bool press, uint64_t time) { if (button == GHOST_NDOF_BUTTON_INVALID) { - CLOG_DEBUG(LOG, "button=%d, press=%d (mapped to none, ignoring!)", int(button), int(press)); + CLOG_DEBUG( + &LOG, "Update button=%d, press=%d (mapped to none, ignoring!)", int(button), int(press)); return; } - CLOG_DEBUG( - LOG, "button=%d, press=%d, name=%s", button, int(press), ndof_button_names.at(button)); + CLOG_DEBUG(&LOG, + "Update button=%d, press=%d, name=%s", + button, + int(press), + ndof_button_names.at(button)); #ifndef USE_3DCONNEXION_NONSTANDARD_KEYS if (((button >= GHOST_NDOF_BUTTON_KBP_F1) && (button <= GHOST_NDOF_BUTTON_KBP_F12)) || @@ -547,7 +544,8 @@ void GHOST_NDOFManager::updateButtonRAW(int button_number, bool press, uint64_t bitmask_devices_.end()) { if (button_number >= hid_map_button_num_) { - CLOG_DEBUG(LOG, "button=%d, press=%d (out of range, ignoring!)", button_number, int(press)); + CLOG_DEBUG( + &LOG, "Update button=%d, press=%d (out of range, ignoring!)", button_number, int(press)); return; } button = hid_map_[button_number]; @@ -632,7 +630,6 @@ void GHOST_NDOFManager::updateButtonsArray(NDOF_Button_Array buttons, } cache = buttons; } -#undef LOG /** \} */ @@ -640,9 +637,6 @@ void GHOST_NDOFManager::updateButtonsArray(NDOF_Button_Array buttons, /** \name NDOF Motion * \{ */ -static CLG_LogRef LOG_NDOF_MOTION = {"ghost.ndof.motion"}; -#define LOG (&LOG_NDOF_MOTION) - void GHOST_NDOFManager::setDeadZone(float dz) { /* Negative values don't make sense, so clamp at zero. */ @@ -650,7 +644,7 @@ void GHOST_NDOFManager::setDeadZone(float dz) motion_dead_zone_ = dz; /* Warn the rogue user/developer about high dead-zone, but allow it. */ - CLOG_DEBUG(LOG, "dead zone set to %.2f%s", dz, (dz > 0.5f) ? " (unexpectedly high)" : ""); + CLOG_INFO(&LOG, "Dead zone set to %.2f%s", dz, (dz > 0.5f) ? " (unexpectedly high)" : ""); } static bool atHomePosition(const GHOST_TEventNDOFMotionData *ndof) @@ -731,7 +725,7 @@ bool GHOST_NDOFManager::sendMotionEvent() } else { /* Send no event and keep current state. */ - CLOG_DEBUG(LOG, "motion ignored"); + CLOG_DEBUG(&LOG, "Motion ignored"); delete event; return false; } @@ -755,8 +749,8 @@ bool GHOST_NDOFManager::sendMotionEvent() } #if 1 - CLOG_DEBUG(LOG, - "motion sent, T=(%.2f,%.2f,%.2f), R=(%.2f,%.2f,%.2f) dt=%.3f, status=%s", + CLOG_DEBUG(&LOG, + "Motion sent, T=(%.2f,%.2f,%.2f), R=(%.2f,%.2f,%.2f) dt=%.3f, status=%s", data->tx, data->ty, data->tz, @@ -767,8 +761,8 @@ bool GHOST_NDOFManager::sendMotionEvent() ndof_progress_string[data->progress]); #else /* Raw values, may be useful for debugging. */ - CLOG_DEBUG(LOG, - "motion sent, T=(%d,%d,%d) R=(%d,%d,%d) status=%s", + CLOG_DEBUG(&LOG, + "Motion sent, T=(%d,%d,%d) R=(%d,%d,%d) status=%s", translation_[0], translation_[1], translation_[2], diff --git a/intern/ghost/intern/GHOST_NDOFManagerUnix.cc b/intern/ghost/intern/GHOST_NDOFManagerUnix.cc index 838d0af1059..ed8b78c594f 100644 --- a/intern/ghost/intern/GHOST_NDOFManagerUnix.cc +++ b/intern/ghost/intern/GHOST_NDOFManagerUnix.cc @@ -14,17 +14,16 @@ static const char *spnav_sock_path = "/var/run/spnav.sock"; -static CLG_LogRef LOG_NDOF_UNIX = {"ghost.ndof.unix"}; -#define LOG (&LOG_NDOF_UNIX) +static CLG_LogRef LOG = {"ghost.ndof"}; GHOST_NDOFManagerUnix::GHOST_NDOFManagerUnix(GHOST_System &sys) : GHOST_NDOFManager(sys), available_(false) { if (access(spnav_sock_path, F_OK) != 0) { - CLOG_INFO(LOG, "'spacenavd' not found at \"%s\"", spnav_sock_path); + CLOG_DEBUG(&LOG, "'spacenavd' not found at \"%s\"", spnav_sock_path); } else if (spnav_open() != -1) { - CLOG_INFO(LOG, "'spacenavd' found at\"%s\"", spnav_sock_path); + CLOG_DEBUG(&LOG, "'spacenavd' found at\"%s\"", spnav_sock_path); available_ = true; /* determine exactly which device (if any) is plugged in */ diff --git a/source/blender/windowmanager/intern/wm_event_system.cc b/source/blender/windowmanager/intern/wm_event_system.cc index a8a3b4f9687..83775dc079d 100644 --- a/source/blender/windowmanager/intern/wm_event_system.cc +++ b/source/blender/windowmanager/intern/wm_event_system.cc @@ -1175,9 +1175,8 @@ static void wm_operator_reports(bContext *C, } std::string pystring = WM_operator_pystring(C, op, false, true); - if (retval & OPERATOR_FINISHED) { - CLOG_INFO(WM_LOG_OPERATORS, "Finished %s", pystring.c_str()); + if (retval & OPERATOR_FINISHED) { if (caller_owns_reports == false) { /* Print out reports to console. * When quiet, only show warnings, suppressing info and other non-essential warnings. */ @@ -1192,9 +1191,12 @@ static void wm_operator_reports(bContext *C, } } } - else { - CLOG_INFO(WM_LOG_OPERATORS, "Cancelled %s", pystring.c_str()); - } + + CLOG_AT_LEVEL(WM_LOG_OPERATORS, + /* Avoid logging very noisy hover/timer driven operators at info level. */ + ((op->type->flag & OPTYPE_REGISTER) ? CLG_LEVEL_INFO : CLG_LEVEL_DEBUG), + (retval & OPERATOR_FINISHED) ? "Finished %s" : "Cancelled: %s", + pystring.c_str()); /* Refresh Info Editor with reports immediately, even if op returned #OPERATOR_CANCELLED. */ if ((retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED)) && @@ -1607,7 +1609,11 @@ static wmOperatorStatus wm_operator_invoke(bContext *C, /* If `reports == nullptr`, they'll be initialized. */ wmOperator *op = wm_operator_create(wm, ot, properties, reports); - CLOG_INFO(WM_LOG_OPERATORS, "Started %s", WM_operator_pystring(C, op, false, true).c_str()); + CLOG_AT_LEVEL(WM_LOG_OPERATORS, + /* Avoid logging very noisy hover/timer driven operators at info level. */ + ((op->type->flag & OPTYPE_REGISTER) ? CLG_LEVEL_INFO : CLG_LEVEL_DEBUG), + "Started %s", + WM_operator_pystring(C, op, false, true).c_str()); const bool is_nested_call = (wm->op_undo_depth != 0); @@ -1622,7 +1628,7 @@ static wmOperatorStatus wm_operator_invoke(bContext *C, if ((event == nullptr) || (event->type != MOUSEMOVE)) { CLOG_DEBUG(WM_LOG_EVENTS, - "handle evt %d win %p op %s", + "Handle event %d win %p op %s", event ? event->type : 0, CTX_wm_screen(C)->active_region, ot->idname); @@ -2680,7 +2686,7 @@ static eHandlerActionFlag wm_handler_operator_call(bContext *C, } } else { - CLOG_ERROR(WM_LOG_EVENTS, "missing modal '%s'", op->idname); + CLOG_ERROR(WM_LOG_EVENTS, "Missing modal '%s'", op->idname); } } else { @@ -3107,7 +3113,7 @@ static eHandlerActionFlag wm_handlers_do_keymap_with_keymap_handler( C, handlers, &handler->head, event, kmi->ptr, kmi->idname); CLOG_DEBUG(WM_LOG_EVENTS, - "keymap '%s', %s, %s, event: %s", + "Keymap '%s', %s, %s, event: %s", keymap->idname, keymap_handler_log_kmi_op_str(C, kmi).c_str(), keymap_handler_log_action_str(action), @@ -3648,7 +3654,7 @@ static eHandlerActionFlag wm_handlers_do(bContext *C, wmEvent *event, ListBase * event->keymodifier = event->prev_press_keymodifier; event->direction = direction; - CLOG_DEBUG(WM_LOG_EVENTS, "handling CLICK_DRAG"); + CLOG_DEBUG(WM_LOG_EVENTS, "Handling CLICK_DRAG"); action |= wm_handlers_do_intern(C, win, event, handlers); @@ -3661,7 +3667,7 @@ static eHandlerActionFlag wm_handlers_do(bContext *C, wmEvent *event, ListBase * win->event_queue_check_click = false; if (!((action & WM_HANDLER_BREAK) == 0 || wm_action_not_handled(action))) { /* Only disable when handled as other handlers may use this drag event. */ - CLOG_DEBUG(WM_LOG_EVENTS, "canceling CLICK_DRAG: drag was generated & handled"); + CLOG_DEBUG(WM_LOG_EVENTS, "Canceling CLICK_DRAG: drag was generated & handled"); win->event_queue_check_drag = false; } } @@ -3669,7 +3675,7 @@ static eHandlerActionFlag wm_handlers_do(bContext *C, wmEvent *event, ListBase * } else { if (win->event_queue_check_drag) { - CLOG_DEBUG(WM_LOG_EVENTS, "canceling CLICK_DRAG: motion event was handled"); + CLOG_DEBUG(WM_LOG_EVENTS, "Canceling CLICK_DRAG: motion event was handled"); win->event_queue_check_drag = false; } } @@ -3686,7 +3692,7 @@ static eHandlerActionFlag wm_handlers_do(bContext *C, wmEvent *event, ListBase * if ((event->flag & WM_EVENT_IS_REPEAT) == 0) { win->event_queue_check_click = true; - CLOG_DEBUG(WM_LOG_EVENTS, "detecting CLICK_DRAG: press event detected"); + CLOG_DEBUG(WM_LOG_EVENTS, "Detecting CLICK_DRAG: press event detected"); win->event_queue_check_drag = true; win->event_queue_check_drag_handled = false; @@ -3700,7 +3706,7 @@ static eHandlerActionFlag wm_handlers_do(bContext *C, wmEvent *event, ListBase * /* Support releasing modifier keys without canceling the drag event, see #89989. */ } else { - CLOG_DEBUG(WM_LOG_EVENTS, "CLICK_DRAG: canceling (release event didn't match press)"); + CLOG_DEBUG(WM_LOG_EVENTS, "Canceling CLICK_DRAG (release event didn't match press)"); win->event_queue_check_drag = false; } } @@ -3714,7 +3720,7 @@ static eHandlerActionFlag wm_handlers_do(bContext *C, wmEvent *event, ListBase * win->event_queue_check_click = false; if (win->event_queue_check_drag) { CLOG_DEBUG(WM_LOG_EVENTS, - "CLICK_DRAG: canceling (key-release exceeds drag threshold)"); + "Canceling CLICK_DRAG (key-release exceeds drag threshold)"); win->event_queue_check_drag = false; } } @@ -3726,7 +3732,7 @@ static eHandlerActionFlag wm_handlers_do(bContext *C, wmEvent *event, ListBase * copy_v2_v2_int(event->xy, event->prev_press_xy); event->val = KM_CLICK; - CLOG_DEBUG(WM_LOG_EVENTS, "CLICK: handling"); + CLOG_DEBUG(WM_LOG_EVENTS, "Handling CLICK"); action |= wm_handlers_do_intern(C, win, event, handlers); @@ -3753,7 +3759,7 @@ static eHandlerActionFlag wm_handlers_do(bContext *C, wmEvent *event, ListBase * if (win->event_queue_check_drag) { CLOG_DEBUG(WM_LOG_EVENTS, - "CLICK_DRAG: canceling (button event was handled: value=%d)", + "Canceling CLICK_DRAG (button event was handled: value=%d)", event->val); win->event_queue_check_drag = false; } @@ -4135,13 +4141,13 @@ void wm_event_do_handlers(bContext *C) event->flag |= WM_EVENT_IS_CONSECUTIVE; } else if (is_consecutive || WM_event_consecutive_gesture_test_break(win, event)) { - CLOG_DEBUG(WM_LOG_EVENTS, "consecutive gesture break (%d)", event->type); + CLOG_DEBUG(WM_LOG_EVENTS, "Consecutive gesture break (%d)", event->type); win->event_queue_consecutive_gesture_type = EVENT_NONE; WM_event_consecutive_data_free(win); } } else if (is_consecutive) { - CLOG_DEBUG(WM_LOG_EVENTS, "consecutive gesture begin (%d)", event->type); + CLOG_DEBUG(WM_LOG_EVENTS, "Consecutive gesture begin (%d)", event->type); win->event_queue_consecutive_gesture_type = event->type; copy_v2_v2_int(win->event_queue_consecutive_gesture_xy, event->xy); /* While this should not be set, it's harmless to free here. */ @@ -4160,7 +4166,7 @@ void wm_event_do_handlers(bContext *C) /* Take care of pie event filter. */ if (wm_event_pie_filter(win, event)) { if (!ISMOUSE_MOTION(event->type)) { - CLOG_DEBUG(WM_LOG_EVENTS, "event filtered due to pie button pressed"); + CLOG_DEBUG(WM_LOG_EVENTS, "Event filtered due to pie button pressed"); } BLI_remlink(&win->runtime->event_queue, event); wm_event_free_last_handled(win, event); @@ -5811,7 +5817,7 @@ static void wm_event_state_update_and_click_set_ex(wmEvent *event, if (check_double_click && wm_event_is_double_click(event, event_time_ms, *event_state_prev_press_time_ms_p)) { - CLOG_DEBUG(WM_LOG_EVENTS, "DBL_CLICK: detected"); + CLOG_DEBUG(WM_LOG_EVENTS, "Detected DBL_CLICK"); event->val = KM_DBL_CLICK; } else if (event->val == KM_PRESS) {