From 798d367d54a6c6379ad355bd8345fa40e31e7fe9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 6 Sep 2008 18:24:57 -0500 Subject: Second Life viewer sources 1.21.0-RC --- linden/indra/llcrashlogger/CMakeLists.txt | 35 ++++++++++++++++++++++++++++ linden/indra/llcrashlogger/files.lst | 1 - linden/indra/llcrashlogger/llcrashlogger.cpp | 27 +++++++++++---------- linden/indra/llcrashlogger/llcrashlogger.h | 18 +++++++------- 4 files changed, 57 insertions(+), 24 deletions(-) create mode 100644 linden/indra/llcrashlogger/CMakeLists.txt delete mode 100644 linden/indra/llcrashlogger/files.lst (limited to 'linden/indra/llcrashlogger') diff --git a/linden/indra/llcrashlogger/CMakeLists.txt b/linden/indra/llcrashlogger/CMakeLists.txt new file mode 100644 index 0000000..b2639ae --- /dev/null +++ b/linden/indra/llcrashlogger/CMakeLists.txt @@ -0,0 +1,35 @@ +# -*- cmake -*- + +project(llcrashlogger) + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLVFS) +include(LLXML) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llcrashlogger_SOURCE_FILES + llcrashlogger.cpp + ) + +set(llcrashlogger_HEADER_FILES + CMakeLists.txt + + llcrashlogger.h + ) + +set_source_files_properties(${llcrashlogger_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llcrashlogger_SOURCE_FILES ${llcrashlogger_HEADER_FILES}) + +add_library(llcrashlogger ${llcrashlogger_SOURCE_FILES}) diff --git a/linden/indra/llcrashlogger/files.lst b/linden/indra/llcrashlogger/files.lst deleted file mode 100644 index d976a60..0000000 --- a/linden/indra/llcrashlogger/files.lst +++ /dev/null @@ -1 +0,0 @@ -llcrashlogger/llcrashlogger.cpp \ No newline at end of file diff --git a/linden/indra/llcrashlogger/llcrashlogger.cpp b/linden/indra/llcrashlogger/llcrashlogger.cpp index 306046a..57fa33b 100755 --- a/linden/indra/llcrashlogger/llcrashlogger.cpp +++ b/linden/indra/llcrashlogger/llcrashlogger.cpp @@ -76,7 +76,7 @@ bool LLCrashLoggerText::mainLoop() return true; } -void LLCrashLoggerText::updateApplication(LLString message) +void LLCrashLoggerText::updateApplication(const std::string& message) { LLCrashLogger::updateApplication(message); std::cout << message << std::endl; @@ -147,10 +147,8 @@ void LLCrashLogger::gatherFiles() updateApplication("Gathering logs..."); // Figure out the filename of the debug log - std::string db_file_name = gDirUtilp->getExpandedFilename( - LL_PATH_LOGS, - "debug_info.log"); - llifstream debug_log_file(db_file_name.c_str()); + std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); + std::ifstream debug_log_file(db_file_name.c_str()); // Look for it in the debug_info.log file if (debug_log_file.is_open()) @@ -191,7 +189,7 @@ void LLCrashLogger::gatherFiles() { // This is a 'little' hacky, but its the best simple solution. std::string grid_host = mDebugLog["GridName"].asString(); - LLString::toLower(grid_host); + LLStringUtil::toLower(grid_host); mCrashHost = "https://login."; mCrashHost += grid_host; @@ -207,12 +205,12 @@ void LLCrashLogger::gatherFiles() updateApplication("Encoding files..."); - for(std::map::iterator itr = mFileMap.begin(); itr != mFileMap.end(); ++itr) + for(std::map::iterator itr = mFileMap.begin(); itr != mFileMap.end(); ++itr) { std::ifstream f((*itr).second.c_str()); if(!f.is_open()) { - std::cout << "Can't find file " << (*itr).second.c_str() << std::endl; + std::cout << "Can't find file " << (*itr).second << std::endl; continue; } std::stringstream s; @@ -265,10 +263,10 @@ bool LLCrashLogger::saveCrashBehaviorSetting(S32 crash_behavior) return true; } -bool LLCrashLogger::runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout) +bool LLCrashLogger::runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout) { gBreak = false; - LLString status_message; + std::string status_message; for(int i = 0; i < retries; ++i) { status_message = llformat("%s, try %d...", msg.c_str(), i+1); @@ -304,14 +302,15 @@ bool LLCrashLogger::sendCrashLogs() bool sent = false; + //*TODO: Translate if(mCrashHost != "") { - sent = runCrashLogPost(mCrashHost, post_data, "Sending to server", 3, 5); + sent = runCrashLogPost(mCrashHost, post_data, std::string("Sending to server"), 3, 5); } if(!sent) { - sent = runCrashLogPost(mAltCrashHost, post_data, "Sending to alternate server", 3, 5); + sent = runCrashLogPost(mAltCrashHost, post_data, std::string("Sending to alternate server"), 3, 5); } mSentCrashLogs = sent; @@ -319,7 +318,7 @@ bool LLCrashLogger::sendCrashLogs() return true; } -void LLCrashLogger::updateApplication(LLString message) +void LLCrashLogger::updateApplication(const std::string& message) { gServicePump->pump(); gServicePump->callback(); @@ -372,7 +371,7 @@ bool LLCrashLogger::init() //If we've opened the crash logger, assume we can delete the marker file if it exists if( gDirUtilp ) { - LLString marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); + std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); ll_apr_file_remove( marker_file ); } diff --git a/linden/indra/llcrashlogger/llcrashlogger.h b/linden/indra/llcrashlogger/llcrashlogger.h index bf51e71..f8f7de7 100755 --- a/linden/indra/llcrashlogger/llcrashlogger.h +++ b/linden/indra/llcrashlogger/llcrashlogger.h @@ -50,23 +50,23 @@ public: bool saveCrashBehaviorSetting(S32 crash_behavior); bool sendCrashLogs(); LLSD constructPostData(); - virtual void updateApplication(LLString message = ""); + virtual void updateApplication(const std::string& message = LLStringUtil::null); virtual bool init(); virtual bool mainLoop() = 0; virtual bool cleanup() { return true; } - void setUserText(LLString& text) { mCrashInfo["UserNotes"] = text; } + void setUserText(const std::string& text) { mCrashInfo["UserNotes"] = text; } S32 getCrashBehavior() { return mCrashBehavior; } - bool runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout); + bool runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout); protected: S32 mCrashBehavior; BOOL mCrashInPreviousExec; - std::map mFileMap; - LLString mGridName; + std::map mFileMap; + std::string mGridName; LLControlGroup mCrashSettings; - LLString mProductName; + std::string mProductName; LLSD mCrashInfo; - LLString mCrashHost; - LLString mAltCrashHost; + std::string mCrashHost; + std::string mAltCrashHost; LLSD mDebugLog; bool mSentCrashLogs; }; @@ -78,7 +78,7 @@ public: ~LLCrashLoggerText(void) {} virtual bool mainLoop(); - virtual void updateApplication(LLString message = ""); + virtual void updateApplication(const std::string& message = LLStringUtil::null); }; -- cgit v1.1