这篇教程C++ DebugLogger函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DebugLogger函数的典型用法代码示例。如果您正苦于以下问题:C++ DebugLogger函数的具体用法?C++ DebugLogger怎么用?C++ DebugLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DebugLogger函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: m_player_name// static member(s)AIClientApp::AIClientApp(const std::vector<std::string>& args) : m_player_name(""), m_max_aggression(0){ if (args.size() < 2) { std::cerr << "The AI client should not be executed directly! Run freeorion to start the game."; ExitApp(1); } // read command line args m_player_name = args.at(1); if (args.size() >=3) { m_max_aggression = boost::lexical_cast<int>(args.at(2)); } // Force the log file if requested. if (GetOptionsDB().Get<std::string>("log-file").empty()) { const std::string AICLIENT_LOG_FILENAME((GetUserDataDir() / (m_player_name + ".log")).string()); GetOptionsDB().Set("log-file", AICLIENT_LOG_FILENAME); } // Force the log threshold if requested. auto force_log_level = GetOptionsDB().Get<std::string>("log-level"); if (!force_log_level.empty()) OverrideAllLoggersThresholds(to_LogLevel(force_log_level)); InitLoggingSystem(GetOptionsDB().Get<std::string>("log-file"), "AI"); InitLoggingOptionsDBSystem(); InfoLogger() << FreeOrionVersionString(); DebugLogger() << PlayerName() + " ai client initialized.";}
开发者ID:adrianbroher,项目名称:freeorion,代码行数:33,
示例2: Clientboost::statechart::result WaitingForMPJoinAck::react(const JoinGame& msg) { if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) WaitingForMPJoinAck.JoinGame"; Client().Networking().SetPlayerID(msg.m_message.ReceivingPlayer()); return transit<MPLobby>();}
开发者ID:hworpel,项目名称:freeorion,代码行数:7,
示例3: TraceLoggerboost::statechart::result WaitingForTurnData::react(const TurnUpdate& msg) { TraceLogger(FSM) << "(HumanClientFSM) PlayingGame.TurnUpdate"; int current_turn = INVALID_GAME_TURN; try { ExtractTurnUpdateMessageData(msg.m_message, Client().EmpireID(), current_turn, Empires(), GetUniverse(), GetSpeciesManager(), GetCombatLogManager(), GetSupplyManager(), Client().Players()); } catch (...) { Client().GetClientUI().GetMessageWnd()->HandleLogMessage(UserString("ERROR_PROCESSING_SERVER_MESSAGE") + "/n"); return discard_event(); } DebugLogger(FSM) << "Extracted TurnUpdate message for turn: " << current_turn; Client().SetCurrentTurn(current_turn); // if I am the host, do autosave if (Client().Networking().PlayerIsHost(Client().PlayerID())) Client().Autosave(); Client().HandleTurnUpdate(); return transit<PlayingTurn>();}
开发者ID:MatGB,项目名称:freeorion,代码行数:26,
示例4: discard_eventboost::statechart::result MPLobby::react(const LobbyUpdate& msg) { if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) MPLobby.LobbyUpdate"; MultiplayerLobbyData lobby_data; ExtractMessageData(msg.m_message, lobby_data); Client().GetClientUI()->GetMultiPlayerLobbyWnd()->LobbyUpdate(lobby_data); return discard_event();}
开发者ID:hworpel,项目名称:freeorion,代码行数:7,
示例5: DebugLoggervoid ProductionWnd::UpdateQueue() { DebugLogger() << "ProductionWnd::UpdateQueue()"; ScopedTimer timer("ProductionWnd::UpdateQueue"); m_queue_wnd->SetEmpire(m_empire_shown_id); QueueListBox* queue_lb = m_queue_wnd->GetQueueListBox(); std::size_t first_visible_queue_row = std::distance(queue_lb->begin(), queue_lb->FirstRowShown()); queue_lb->Clear(); const Empire* empire = GetEmpire(m_empire_shown_id); if (!empire) return; const ProductionQueue& queue = empire->GetProductionQueue(); int i = 0; for (ProductionQueue::const_iterator it = queue.begin(); it != queue.end(); ++it, ++i) { QueueRow* row = new QueueRow(queue_lb->RowWidth(), *it, i); GG::Connect(row->RowQuantChangedSignal, &ProductionWnd::ChangeBuildQuantityBlockSlot, this); queue_lb->Insert(row); } if (!queue_lb->Empty()) queue_lb->BringRowIntoView(--queue_lb->end()); if (first_visible_queue_row < queue_lb->NumRows()) queue_lb->BringRowIntoView(boost::next(queue_lb->begin(), first_visible_queue_row));}
开发者ID:Ouaz,项目名称:freeorion,代码行数:28,
示例6: DeleteSideBarsvoid GraphicalSummaryWnd::GenerateGraph() { DeleteSideBars(); m_sizer.reset(new BarSizer(m_summaries, ClientSize())); for (std::map<int, CombatSummary>::iterator it = m_summaries.begin(); it != m_summaries.end(); ++it) { if (it->second.total_max_health > EPSILON) { it->second.Sort(); SideBar* box = new SideBar(it->second, *m_sizer); m_side_boxes.push_back(box); AttachChild(box); } } if (m_options_bar) { DebugLogger() << "GraphicalSummaryWnd::GenerateGraph(): m_options_bar " "already exists, calling DeleteChild(m_options_bar) " "before creating a new one."; DeleteChild(m_options_bar); } m_options_bar = new OptionsBar(m_sizer); AttachChild(m_options_bar); GG::Connect(m_options_bar->ChangedSignal, &GraphicalSummaryWnd::HandleButtonChanged, this); MinSizeChangedSignal(); DoLayout();}
开发者ID:spikethehobbitmage,项目名称:freeorion,代码行数:29,
示例7: ExtractMessageDataboost::statechart::result PlayingGame::react(const EndGame& msg) { if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) PlayingGame.EndGame"; Message::EndGameReason reason; std::string reason_player_name; ExtractMessageData(msg.m_message, reason, reason_player_name); std::string reason_message; bool error = false; switch (reason) { case Message::LOCAL_CLIENT_DISCONNECT: Client().EndGame(true); reason_message = UserString("SERVER_LOST"); break; case Message::PLAYER_DISCONNECT: Client().EndGame(true); reason_message = boost::io::str(FlexibleFormat(UserString("PLAYER_DISCONNECTED")) % reason_player_name); error = true; break; } //Note: Any transit<> transition must occur before the MessageBox(). // MessageBox blocks and can allow other events to transit<> to a new state // which makes this transit fatal. boost::statechart::result retval = transit<IntroMenu>(); ClientUI::MessageBox(reason_message, error); return retval;}
开发者ID:Ouaz,项目名称:freeorion,代码行数:25,
示例8: Base////////////////////////////////////////////////////////////// IntroMenu////////////////////////////////////////////////////////////IntroMenu::IntroMenu(my_context ctx) : Base(ctx){ if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) IntroMenu"; Client().KillServer(); Client().GetClientUI()->ShowIntroScreen();}
开发者ID:Ouaz,项目名称:freeorion,代码行数:10,
示例9: ExtractMessageDataboost::statechart::result PlayingGame::react(const EndGame& msg) { if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) PlayingGame.EndGame"; Message::EndGameReason reason; std::string reason_player_name; ExtractMessageData(msg.m_message, reason, reason_player_name); std::string reason_message; bool error = false; switch (reason) { case Message::LOCAL_CLIENT_DISCONNECT: Client().EndGame(true); reason_message = UserString("SERVER_LOST"); break; case Message::PLAYER_DISCONNECT: Client().EndGame(true); reason_message = boost::io::str(FlexibleFormat(UserString("PLAYER_DISCONNECTED")) % reason_player_name); error = true; break; case Message::YOU_ARE_ELIMINATED: Client().EndGame(true); reason_message = UserString("PLAYER_DEFEATED"); break; } ClientUI::MessageBox(reason_message, error); Client().Remove(Client().GetClientUI()->GetMapWnd()); Client().GetClientUI()->GetMapWnd()->RemoveWindows(); Client().Networking().SetHostPlayerID(Networking::INVALID_PLAYER_ID); Client().Networking().SetPlayerID(Networking::INVALID_PLAYER_ID); return transit<IntroMenu>();}
开发者ID:hworpel,项目名称:freeorion,代码行数:29,
示例10: DebugLoggerHullTypeManager::HullTypeManager() { if (s_instance) throw std::runtime_error("Attempted to create more than one HullTypeManager."); s_instance = this; parse::ship_hulls(GetResourceDir() / "ship_hulls.txt", m_hulls); if (GetOptionsDB().Get<bool>("verbose-logging")) { DebugLogger() << "Hull Types:"; for (iterator it = begin(); it != end(); ++it) { const HullType* h = it->second; DebugLogger() << " ... " << h->Name(); } }}
开发者ID:TeoTwawki,项目名称:freeorion,代码行数:16,
示例11: DebugLoggervoid HumanClientApp::KillServer() { DebugLogger() << "HumanClientApp::KillServer()"; m_server_process.Kill(); m_networking.SetPlayerID(Networking::INVALID_PLAYER_ID); m_networking.SetHostPlayerID(Networking::INVALID_PLAYER_ID); SetEmpireID(ALL_EMPIRES);}
开发者ID:Deepsloth,项目名称:freeorion,代码行数:7,
示例12: TraceLoggerboost::statechart::result QuittingGame::react(const ShutdownServer& u) { TraceLogger(FSM) << "(HumanClientFSM) QuittingGame.ShutdownServer"; if (!m_server_process) { ErrorLogger(FSM) << "m_server_process is nullptr"; post_event(TerminateServer()); return discard_event(); } if (m_server_process->Empty()) { if (Client().Networking().IsTxConnected()) { WarnLogger(FSM) << "Disconnecting from server that is already killed."; Client().Networking().DisconnectFromServer(); } post_event(TerminateServer()); return discard_event(); } if (Client().Networking().IsTxConnected()) { DebugLogger(FSM) << "Sending server shutdown message."; Client().Networking().SendMessage(ShutdownServerMessage()); post_event(WaitForDisconnect()); } else { post_event(TerminateServer()); } return discard_event();}
开发者ID:cpeosphoros,项目名称:freeorion,代码行数:29,
示例13: Base////////////////////////////////////////////////////////////// MPLobby////////////////////////////////////////////////////////////MPLobby::MPLobby(my_context ctx) : Base(ctx){ if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) MPLobby"; Client().Register(Client().GetClientUI()->GetMultiPlayerLobbyWnd());}
开发者ID:hworpel,项目名称:freeorion,代码行数:10,
示例14: Base////////////////////////////////////////////////////////////// PlayingTurn////////////////////////////////////////////////////////////PlayingTurn::PlayingTurn(my_context ctx) : Base(ctx){ if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) PlayingTurn"; Client().Register(Client().GetClientUI()->GetMapWnd()); Client().GetClientUI()->GetMapWnd()->InitTurn(); // TODO: reselect last fleet if stored in save game ui data? Client().GetClientUI()->GetMessageWnd()->HandleGameStatusUpdate( boost::io::str(FlexibleFormat(UserString("TURN_BEGIN")) % CurrentTurn()) + "/n"); Client().GetClientUI()->GetMessageWnd()->HandlePlayerStatusUpdate(Message::PLAYING_TURN, Client().PlayerID()); Client().GetClientUI()->GetPlayerListWnd()->Refresh(); Client().GetClientUI()->GetPlayerListWnd()->HandlePlayerStatusUpdate(Message::PLAYING_TURN, Client().PlayerID()); if (Client().GetApp()->GetClientType() != Networking::CLIENT_TYPE_HUMAN_OBSERVER) Client().GetClientUI()->GetMapWnd()->EnableOrderIssuing(true); if (Client().GetApp()->GetClientType() == Networking::CLIENT_TYPE_HUMAN_OBSERVER) { // observers can't do anything but wait for the next update, and need to // be back in WaitingForTurnData, so posting TurnEnded here has the effect // of keeping observers in the WaitingForTurnData state so they can receive // updates from the server. post_event(TurnEnded()); } else if (Client().GetApp()->GetClientType() == Networking::CLIENT_TYPE_HUMAN_PLAYER) { if (Client().GetClientUI()->GetMapWnd()->AutoEndTurnEnabled()) { // if in-game-GUI auto turn advance enabled, set auto turn counter to 1 Client().InitAutoTurns(1); } if (Client().AutoTurnsLeft() <= 0 && GetOptionsDB().Get<bool>("auto-quit")) { // if no auto turns left, and supposed to quit after that, quit DebugLogger() << "auto-quit ending game."; std::cout << "auto-quit ending game." << std::endl; Client().EndGame(true); throw HumanClientApp::CleanQuit(); } // if there are still auto turns left, advance the turn automatically, // and decrease the auto turn counter if (Client().AutoTurnsLeft() > 0) { post_event(AdvanceTurn()); Client().DecAutoTurns(); } }}
开发者ID:TeoTwawki,项目名称:freeorion,代码行数:50,
示例15: NumPlayableSpeciesconst std::string& SpeciesManager::SequentialPlayableSpeciesName(int id) const { if (NumPlayableSpecies() <= 0) return EMPTY_STRING; int species_idx = id % NumPlayableSpecies(); DebugLogger() << "SpeciesManager::SequentialPlayableSpeciesName has " << NumPlayableSpecies() << " and is given id " << id << " yielding index " << species_idx; return std::next(playable_begin(), species_idx)->first;}
开发者ID:adrianbroher,项目名称:freeorion,代码行数:8,
示例16: DebugLoggervoid Species::AddHomeworld(int homeworld_id) { if (!GetUniverseObject(homeworld_id)) DebugLogger() << "Species asked to add homeworld id " << homeworld_id << " but there is no such object in the Universe"; if (m_homeworlds.find(homeworld_id) != m_homeworlds.end()) return; m_homeworlds.insert(homeworld_id); // TODO if needed: StateChangedSignal();}
开发者ID:Blue42hand,项目名称:freeorion,代码行数:8,
示例17: DebugLoggervoid InGameMenu::Save() { DebugLogger() << "InGameMenu::Save"; HumanClientApp* app = HumanClientApp::GetApp(); if (!app) return; if (!app->CanSaveNow()) { ErrorLogger() << "InGameMenu::Save aborting; Client app can't save now"; return; } const std::string SAVE_GAME_EXTENSION = app->SinglePlayerGame() ? SP_SAVE_FILE_EXTENSION : MP_SAVE_FILE_EXTENSION; try { std::string filename; // When saving in multiplayer, you cannot see the old saves or // browse directories, only give a save file name. if (app->SinglePlayerGame()) { DebugLogger() << "... running save file dialog"; SaveFileDialog dlg(SAVE_GAME_EXTENSION); dlg.Run(); filename = dlg.Result(); } else { /// Multiplayer save. Talk to the server. filename = app->SelectSaveFile(); } if (!filename.empty()) { if (!app->CanSaveNow()) { ErrorLogger() << "InGameMenu::Save aborting; Client app can't save now"; throw std::runtime_error(UserString("UNABLE_TO_SAVE_NOW_TRY_AGAIN")); } DebugLogger() << "... initiating save to " << filename ; app->SaveGame(filename); CloseClicked(); DebugLogger() << "... save done"; } } catch (const std::exception& e) { ErrorLogger() << "Exception thrown attempting save: " << e.what(); ClientUI::MessageBox(e.what(), true); }}
开发者ID:Deepsloth,项目名称:freeorion,代码行数:45,
示例18: LoadPlayerSaveHeaderDatavoid LoadPlayerSaveHeaderData(const std::string& filename, std::vector<PlayerSaveHeaderData>& player_save_header_data) { SaveGamePreviewData ignored_save_preview_data; ServerSaveGameData ignored_server_save_game_data; GalaxySetupData ignored_galaxy_setup_data; ScopedTimer timer("LoadPlayerSaveHeaderData: " + filename, true); try { DebugLogger() << "Reading player save game data from: " << filename; fs::path path = FilenameToPath(filename); fs::ifstream ifs(path, std::ios_base::binary); if (!ifs) throw std::runtime_error(UNABLE_TO_OPEN_FILE); try { // first attempt binary deserialziation DebugLogger() << "Attempting binary deserialization..."; freeorion_bin_iarchive ia(ifs); ia >> BOOST_SERIALIZATION_NVP(ignored_save_preview_data); ia >> BOOST_SERIALIZATION_NVP(ignored_galaxy_setup_data); ia >> BOOST_SERIALIZATION_NVP(ignored_server_save_game_data); ia >> BOOST_SERIALIZATION_NVP(player_save_header_data); } catch (...) { // if binary deserialization failed, try more-portable XML deserialization DebugLogger() << "Trying again with XML deserialization..."; // reset to start of stream (attempted binary serialization will have consumed some input...) boost::iostreams::seek(ifs, 0, std::ios_base::beg); freeorion_xml_iarchive ia(ifs); ia >> BOOST_SERIALIZATION_NVP(ignored_save_preview_data); ia >> BOOST_SERIALIZATION_NVP(ignored_galaxy_setup_data); ia >> BOOST_SERIALIZATION_NVP(ignored_server_save_game_data); ia >> BOOST_SERIALIZATION_NVP(player_save_header_data); } // skipping additional deserialization which is not needed for this function DebugLogger() << "Done reading player save game data..."; } catch (const std::exception& e) { ErrorLogger() << UserString("UNABLE_TO_READ_SAVE_FILE") << " LoadPlayerSaveGameData exception: " << ": " << e.what(); throw e; }}
开发者ID:Hacklin,项目名称:freeorion,代码行数:45,
示例19: boost::statechart::result MPLobby::react(const Disconnection& d) { if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) MPLobby.Disconnection"; //Note: Any transit<> transition must occur before the MessageBox(). // MessageBox blocks and can allow other events to transit<> to a new state // which makes this transit fatal. boost::statechart::result retval = transit<IntroMenu>(); ClientUI::MessageBox(UserString("SERVER_LOST"), true); return retval;}
开发者ID:Ouaz,项目名称:freeorion,代码行数:9,
示例20: CheckPendingSpecialsTypesunsigned int SpecialsManager::GetCheckSum() const { CheckPendingSpecialsTypes(); unsigned int retval{0}; for (auto const& name_type_pair : m_specials) CheckSums::CheckSumCombine(retval, name_type_pair); CheckSums::CheckSumCombine(retval, m_specials.size()); DebugLogger() << "SpecialsManager checksum: " << retval; return retval;}
开发者ID:Vezzra,项目名称:freeorion,代码行数:9,
示例21: Clientboost::statechart::result PlayingGame::react(const ResetToIntroMenu& msg) { if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) PlayingGame.ResetToIntroMenu"; Client().GetClientUI()->GetMessageWnd()->HandleGameStatusUpdate(UserString("RETURN_TO_INTRO") + "/n"); Client().Remove(Client().GetClientUI()->GetMapWnd()); Client().Networking().SetHostPlayerID(Networking::INVALID_PLAYER_ID); Client().Networking().SetPlayerID(Networking::INVALID_PLAYER_ID); return transit<IntroMenu>();}
开发者ID:TeoTwawki,项目名称:freeorion,代码行数:9,
注:本文中的DebugLogger函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DebugMsg函数代码示例 C++ DebugError函数代码示例 |