diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llcrashlogger | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/llcrashlogger')
-rw-r--r-- | linden/indra/llcrashlogger/CMakeLists.txt | 35 | ||||
-rw-r--r-- | linden/indra/llcrashlogger/files.lst | 1 | ||||
-rwxr-xr-x | linden/indra/llcrashlogger/llcrashlogger.cpp | 27 | ||||
-rwxr-xr-x | linden/indra/llcrashlogger/llcrashlogger.h | 18 |
4 files changed, 57 insertions, 24 deletions
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 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | project(llcrashlogger) | ||
4 | |||
5 | include(00-Common) | ||
6 | include(LLCommon) | ||
7 | include(LLMath) | ||
8 | include(LLMessage) | ||
9 | include(LLVFS) | ||
10 | include(LLXML) | ||
11 | |||
12 | include_directories( | ||
13 | ${LLCOMMON_INCLUDE_DIRS} | ||
14 | ${LLMATH_INCLUDE_DIRS} | ||
15 | ${LLMESSAGE_INCLUDE_DIRS} | ||
16 | ${LLVFS_INCLUDE_DIRS} | ||
17 | ${LLXML_INCLUDE_DIRS} | ||
18 | ) | ||
19 | |||
20 | set(llcrashlogger_SOURCE_FILES | ||
21 | llcrashlogger.cpp | ||
22 | ) | ||
23 | |||
24 | set(llcrashlogger_HEADER_FILES | ||
25 | CMakeLists.txt | ||
26 | |||
27 | llcrashlogger.h | ||
28 | ) | ||
29 | |||
30 | set_source_files_properties(${llcrashlogger_HEADER_FILES} | ||
31 | PROPERTIES HEADER_FILE_ONLY TRUE) | ||
32 | |||
33 | list(APPEND llcrashlogger_SOURCE_FILES ${llcrashlogger_HEADER_FILES}) | ||
34 | |||
35 | 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 @@ | |||
1 | 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() | |||
76 | return true; | 76 | return true; |
77 | } | 77 | } |
78 | 78 | ||
79 | void LLCrashLoggerText::updateApplication(LLString message) | 79 | void LLCrashLoggerText::updateApplication(const std::string& message) |
80 | { | 80 | { |
81 | LLCrashLogger::updateApplication(message); | 81 | LLCrashLogger::updateApplication(message); |
82 | std::cout << message << std::endl; | 82 | std::cout << message << std::endl; |
@@ -147,10 +147,8 @@ void LLCrashLogger::gatherFiles() | |||
147 | updateApplication("Gathering logs..."); | 147 | updateApplication("Gathering logs..."); |
148 | 148 | ||
149 | // Figure out the filename of the debug log | 149 | // Figure out the filename of the debug log |
150 | std::string db_file_name = gDirUtilp->getExpandedFilename( | 150 | std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); |
151 | LL_PATH_LOGS, | 151 | std::ifstream debug_log_file(db_file_name.c_str()); |
152 | "debug_info.log"); | ||
153 | llifstream debug_log_file(db_file_name.c_str()); | ||
154 | 152 | ||
155 | // Look for it in the debug_info.log file | 153 | // Look for it in the debug_info.log file |
156 | if (debug_log_file.is_open()) | 154 | if (debug_log_file.is_open()) |
@@ -191,7 +189,7 @@ void LLCrashLogger::gatherFiles() | |||
191 | { | 189 | { |
192 | // This is a 'little' hacky, but its the best simple solution. | 190 | // This is a 'little' hacky, but its the best simple solution. |
193 | std::string grid_host = mDebugLog["GridName"].asString(); | 191 | std::string grid_host = mDebugLog["GridName"].asString(); |
194 | LLString::toLower(grid_host); | 192 | LLStringUtil::toLower(grid_host); |
195 | 193 | ||
196 | mCrashHost = "https://login."; | 194 | mCrashHost = "https://login."; |
197 | mCrashHost += grid_host; | 195 | mCrashHost += grid_host; |
@@ -207,12 +205,12 @@ void LLCrashLogger::gatherFiles() | |||
207 | 205 | ||
208 | updateApplication("Encoding files..."); | 206 | updateApplication("Encoding files..."); |
209 | 207 | ||
210 | for(std::map<LLString, LLString>::iterator itr = mFileMap.begin(); itr != mFileMap.end(); ++itr) | 208 | for(std::map<std::string, std::string>::iterator itr = mFileMap.begin(); itr != mFileMap.end(); ++itr) |
211 | { | 209 | { |
212 | std::ifstream f((*itr).second.c_str()); | 210 | std::ifstream f((*itr).second.c_str()); |
213 | if(!f.is_open()) | 211 | if(!f.is_open()) |
214 | { | 212 | { |
215 | std::cout << "Can't find file " << (*itr).second.c_str() << std::endl; | 213 | std::cout << "Can't find file " << (*itr).second << std::endl; |
216 | continue; | 214 | continue; |
217 | } | 215 | } |
218 | std::stringstream s; | 216 | std::stringstream s; |
@@ -265,10 +263,10 @@ bool LLCrashLogger::saveCrashBehaviorSetting(S32 crash_behavior) | |||
265 | return true; | 263 | return true; |
266 | } | 264 | } |
267 | 265 | ||
268 | bool LLCrashLogger::runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout) | 266 | bool LLCrashLogger::runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout) |
269 | { | 267 | { |
270 | gBreak = false; | 268 | gBreak = false; |
271 | LLString status_message; | 269 | std::string status_message; |
272 | for(int i = 0; i < retries; ++i) | 270 | for(int i = 0; i < retries; ++i) |
273 | { | 271 | { |
274 | status_message = llformat("%s, try %d...", msg.c_str(), i+1); | 272 | status_message = llformat("%s, try %d...", msg.c_str(), i+1); |
@@ -304,14 +302,15 @@ bool LLCrashLogger::sendCrashLogs() | |||
304 | 302 | ||
305 | bool sent = false; | 303 | bool sent = false; |
306 | 304 | ||
305 | //*TODO: Translate | ||
307 | if(mCrashHost != "") | 306 | if(mCrashHost != "") |
308 | { | 307 | { |
309 | sent = runCrashLogPost(mCrashHost, post_data, "Sending to server", 3, 5); | 308 | sent = runCrashLogPost(mCrashHost, post_data, std::string("Sending to server"), 3, 5); |
310 | } | 309 | } |
311 | 310 | ||
312 | if(!sent) | 311 | if(!sent) |
313 | { | 312 | { |
314 | sent = runCrashLogPost(mAltCrashHost, post_data, "Sending to alternate server", 3, 5); | 313 | sent = runCrashLogPost(mAltCrashHost, post_data, std::string("Sending to alternate server"), 3, 5); |
315 | } | 314 | } |
316 | 315 | ||
317 | mSentCrashLogs = sent; | 316 | mSentCrashLogs = sent; |
@@ -319,7 +318,7 @@ bool LLCrashLogger::sendCrashLogs() | |||
319 | return true; | 318 | return true; |
320 | } | 319 | } |
321 | 320 | ||
322 | void LLCrashLogger::updateApplication(LLString message) | 321 | void LLCrashLogger::updateApplication(const std::string& message) |
323 | { | 322 | { |
324 | gServicePump->pump(); | 323 | gServicePump->pump(); |
325 | gServicePump->callback(); | 324 | gServicePump->callback(); |
@@ -372,7 +371,7 @@ bool LLCrashLogger::init() | |||
372 | //If we've opened the crash logger, assume we can delete the marker file if it exists | 371 | //If we've opened the crash logger, assume we can delete the marker file if it exists |
373 | if( gDirUtilp ) | 372 | if( gDirUtilp ) |
374 | { | 373 | { |
375 | LLString marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); | 374 | std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); |
376 | ll_apr_file_remove( marker_file ); | 375 | ll_apr_file_remove( marker_file ); |
377 | } | 376 | } |
378 | 377 | ||
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: | |||
50 | bool saveCrashBehaviorSetting(S32 crash_behavior); | 50 | bool saveCrashBehaviorSetting(S32 crash_behavior); |
51 | bool sendCrashLogs(); | 51 | bool sendCrashLogs(); |
52 | LLSD constructPostData(); | 52 | LLSD constructPostData(); |
53 | virtual void updateApplication(LLString message = ""); | 53 | virtual void updateApplication(const std::string& message = LLStringUtil::null); |
54 | virtual bool init(); | 54 | virtual bool init(); |
55 | virtual bool mainLoop() = 0; | 55 | virtual bool mainLoop() = 0; |
56 | virtual bool cleanup() { return true; } | 56 | virtual bool cleanup() { return true; } |
57 | void setUserText(LLString& text) { mCrashInfo["UserNotes"] = text; } | 57 | void setUserText(const std::string& text) { mCrashInfo["UserNotes"] = text; } |
58 | S32 getCrashBehavior() { return mCrashBehavior; } | 58 | S32 getCrashBehavior() { return mCrashBehavior; } |
59 | bool runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout); | 59 | bool runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout); |
60 | protected: | 60 | protected: |
61 | S32 mCrashBehavior; | 61 | S32 mCrashBehavior; |
62 | BOOL mCrashInPreviousExec; | 62 | BOOL mCrashInPreviousExec; |
63 | std::map<LLString, LLString> mFileMap; | 63 | std::map<std::string, std::string> mFileMap; |
64 | LLString mGridName; | 64 | std::string mGridName; |
65 | LLControlGroup mCrashSettings; | 65 | LLControlGroup mCrashSettings; |
66 | LLString mProductName; | 66 | std::string mProductName; |
67 | LLSD mCrashInfo; | 67 | LLSD mCrashInfo; |
68 | LLString mCrashHost; | 68 | std::string mCrashHost; |
69 | LLString mAltCrashHost; | 69 | std::string mAltCrashHost; |
70 | LLSD mDebugLog; | 70 | LLSD mDebugLog; |
71 | bool mSentCrashLogs; | 71 | bool mSentCrashLogs; |
72 | }; | 72 | }; |
@@ -78,7 +78,7 @@ public: | |||
78 | ~LLCrashLoggerText(void) {} | 78 | ~LLCrashLoggerText(void) {} |
79 | 79 | ||
80 | virtual bool mainLoop(); | 80 | virtual bool mainLoop(); |
81 | virtual void updateApplication(LLString message = ""); | 81 | virtual void updateApplication(const std::string& message = LLStringUtil::null); |
82 | }; | 82 | }; |
83 | 83 | ||
84 | 84 | ||