@@ -321,6 +321,23 @@ void CContextMenu::BuildTopMenuTree(HMENU hMenu)
321321 }
322322}
323323
324+ void CContextMenu::PrintVerboseMenuStructure () const
325+ {
326+ if (!shellanything::LoggerHelper::IsVerboseLoggingEnabled ())
327+ return ;
328+
329+ SA_DECLARE_SCOPE_LOGGER_ARGS (sli);
330+ sli.verbose = true ;
331+ sli.instance = this ;
332+ shellanything::ScopeLogger logger (&sli);
333+
334+ shellanything::ConfigManager& cmgr = shellanything::ConfigManager::GetInstance ();
335+
336+ std::string menu_tree;
337+ cmgr.ToLongString (menu_tree, 0 );
338+ SA_VERBOSE_LOG (INFO) << __FUNCTION__ " (), Menu tree:\n " << menu_tree.c_str ();
339+ }
340+
324341CContextMenu::CContextMenu ()
325342{
326343 SA_VERBOSE_LOG (INFO) << __FUNCTION__ " (), new instance " << ToHexString (this );
@@ -421,13 +438,8 @@ HRESULT STDMETHODCALLTYPE CContextMenu::QueryContextMenu(HMENU hMenu, UINT menu_
421438 UINT num_menu_items = next_command_id - first_command_id;
422439 SA_VERBOSE_LOG (INFO) << __FUNCTION__ " (), statistics: first_command_id=" << first_command_id << " menu_last_command_id=" << menu_last_command_id << " next_command_id=" << next_command_id << " num_menu_items=" << num_menu_items << " .\n " ;
423440
424- // debug the constructed menu tree
425- if (shellanything::LoggerHelper::IsVerboseLoggingEnabled ())
426- {
427- std::string menu_tree;
428- cmgr.ToLongString (menu_tree, 0 );
429- SA_VERBOSE_LOG (INFO) << __FUNCTION__ " (), Menu tree:\n " << menu_tree.c_str ();
430- }
441+ // debug the constructed menu tree, if required
442+ PrintVerboseMenuStructure ();
431443
432444 HRESULT hr = MAKE_HRESULT (SEVERITY_SUCCESS, FACILITY_NULL, num_menu_items);
433445 return hr;
0 commit comments