diff options
Diffstat (limited to 'linden/indra/llcommon/llerror.cpp')
-rw-r--r-- | linden/indra/llcommon/llerror.cpp | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/linden/indra/llcommon/llerror.cpp b/linden/indra/llcommon/llerror.cpp index b74b288..5c7c3cd 100644 --- a/linden/indra/llcommon/llerror.cpp +++ b/linden/indra/llcommon/llerror.cpp | |||
@@ -102,7 +102,7 @@ namespace { | |||
102 | public: | 102 | public: |
103 | RecordToFile(const std::string& filename) | 103 | RecordToFile(const std::string& filename) |
104 | { | 104 | { |
105 | mFile.open(filename.c_str(), llofstream::out | llofstream::app); | 105 | mFile.open(filename, llofstream::out | llofstream::app); |
106 | if (!mFile) | 106 | if (!mFile) |
107 | { | 107 | { |
108 | llinfos << "Error setting log file to " << filename << llendl; | 108 | llinfos << "Error setting log file to " << filename << llendl; |
@@ -168,7 +168,7 @@ namespace { | |||
168 | 168 | ||
169 | private: | 169 | private: |
170 | bool mTimestamp; | 170 | bool mTimestamp; |
171 | typedef enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO}; | 171 | enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO}; |
172 | ANSIState mUseANSI; | 172 | ANSIState mUseANSI; |
173 | void colorANSI(const std::string color) | 173 | void colorANSI(const std::string color) |
174 | { | 174 | { |
@@ -196,7 +196,7 @@ namespace { | |||
196 | virtual void recordMessage(LLError::ELevel level, | 196 | virtual void recordMessage(LLError::ELevel level, |
197 | const std::string& message) | 197 | const std::string& message) |
198 | { | 198 | { |
199 | mBuffer.addLine(message.c_str()); | 199 | mBuffer.addLine(message); |
200 | } | 200 | } |
201 | 201 | ||
202 | private: | 202 | private: |
@@ -305,7 +305,7 @@ namespace | |||
305 | std::string file = dirBase + "logcontrol-dev.xml"; | 305 | std::string file = dirBase + "logcontrol-dev.xml"; |
306 | 306 | ||
307 | llstat stat_info; | 307 | llstat stat_info; |
308 | if (LLFile::stat(file.c_str(), &stat_info)) { | 308 | if (LLFile::stat(file, &stat_info)) { |
309 | // NB: stat returns non-zero if it can't read the file, for example | 309 | // NB: stat returns non-zero if it can't read the file, for example |
310 | // if it doesn't exist. LLFile has no better abstraction for | 310 | // if it doesn't exist. LLFile has no better abstraction for |
311 | // testing for file existence. | 311 | // testing for file existence. |
@@ -321,7 +321,7 @@ namespace | |||
321 | LLSD configuration; | 321 | LLSD configuration; |
322 | 322 | ||
323 | { | 323 | { |
324 | llifstream file(filename().c_str()); | 324 | llifstream file(filename()); |
325 | if (file.is_open()) | 325 | if (file.is_open()) |
326 | { | 326 | { |
327 | LLSDSerialize::fromXML(configuration, file); | 327 | LLSDSerialize::fromXML(configuration, file); |
@@ -1040,17 +1040,37 @@ namespace LLError | |||
1040 | << "(" << site.mLine << ") : "; | 1040 | << "(" << site.mLine << ") : "; |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | if (message.find(functionName(site.mFunction)) == std::string::npos) | ||
1044 | { | ||
1045 | #if LL_WINDOWS | 1043 | #if LL_WINDOWS |
1046 | // DevStudio: __FUNCTION__ already includes the full class name | 1044 | // DevStudio: __FUNCTION__ already includes the full class name |
1047 | #else | 1045 | #else |
1048 | if (site.mClassInfo != typeid(NoClassInfo)) | 1046 | if (site.mClassInfo != typeid(NoClassInfo)) |
1047 | { | ||
1048 | prefix << className(site.mClassInfo) << "::"; | ||
1049 | } | ||
1050 | #endif | ||
1051 | prefix << site.mFunction << ": "; | ||
1052 | |||
1053 | if (site.mPrintOnce) | ||
1054 | { | ||
1055 | std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message); | ||
1056 | if (messageIter != s.uniqueLogMessages.end()) | ||
1057 | { | ||
1058 | messageIter->second++; | ||
1059 | unsigned int num_messages = messageIter->second; | ||
1060 | if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0) | ||
1061 | { | ||
1062 | prefix << "ONCE (" << num_messages << "th time seen): "; | ||
1063 | } | ||
1064 | else | ||
1065 | { | ||
1066 | return; | ||
1067 | } | ||
1068 | } | ||
1069 | else | ||
1049 | { | 1070 | { |
1050 | prefix << className(site.mClassInfo) << "::"; | 1071 | prefix << "ONCE: "; |
1072 | s.uniqueLogMessages[message] = 1; | ||
1051 | } | 1073 | } |
1052 | #endif | ||
1053 | prefix << site.mFunction << ": "; | ||
1054 | } | 1074 | } |
1055 | 1075 | ||
1056 | if (site.mPrintOnce) | 1076 | if (site.mPrintOnce) |