summaryrefslogtreecommitdiff
path: root/indra/test/test.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2019-10-14 15:41:09 -0400
committerNat Goodspeed <nat@lindenlab.com>2020-03-25 18:47:13 -0400
commit6b70493ddb1b95a2d3527e2189f5b94f5a2b606f (patch)
tree0b5aa084f603e024ae4ccc4616af8c3923ab043c /indra/test/test.cpp
parente4d6383c47241fa4c58c2491c2d32046126fe52c (diff)
DRTVWR-476: Make test program --debug switch work like LOGTEST=DEBUG.
The comments within indra/test/test.cpp promise that --debug is, in fact, like LOGTEST=DEBUG. Until now, that was a lie. LOGTEST=level displayed log output on stderr as well as in testprogram.log, while --debug did not. Add LLError::logToStderr() function, and make initForApplication() (i.e. commonInit()) call that instead of instantiating RecordToStderr inline. Also call it when test.cpp recognizes --debug switch. Remove the mFileRecorder, mFixedBufferRecorder and mFileRecorderFileName members from SettingsConfig. That tactic doesn't scale. Instead, add findRecorder<RECORDER>() and removeRecorder<RECORDER>() template functions to locate (or remove) a RecorderPtr to an object of the specified subclass. Both are based on an underlying findRecorderPos<RECORDER>() template function. Since we never expect to manage more than a handful of RecorderPtrs, and since access to the deleted members is very much application setup rather than any kind of ongoing access, a search loop suffices. logToFile() uses removeRecorder<RecordToFile>() rather than removing mFileRecorder (the only use of mFileRecorder). logToFixedBuffer() uses removeRecorder<RecordToFixedBuffer>() rather than removing mFixedBufferRecorder (the only use of mFixedBufferRecorder). Make RecordToFile store the filename with which it was instantiated. Add a getFilename() method to retrieve it. logFileName() is now based on findRecorder<RecordToFile>() instead of mFileRecorderFileName (the only use of mFileRecorderFileName). Make RecordToStderr::mUseANSI a simple bool rather than a three-state enum, and set it immediately on construction. Apparently the reason it was set lazily was because it consults its own checkANSI() method, and of course 'this' doesn't acquire the leaf class type until the constructor has completed successfully. But since nothing in checkANSI() depends on anything else in RecordToStderr, making it static solves that problem.
Diffstat (limited to 'indra/test/test.cpp')
-rw-r--r--indra/test/test.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index b14c2eb255..51f0e80043 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -611,6 +611,9 @@ int main(int argc, char **argv)
wait_at_exit = true;
break;
case 'd':
+ // this is what LLError::initForApplication() does internally
+ // when you pass log_to_stderr=true
+ LLError::logToStderr();
LLError::setDefaultLevel(LLError::LEVEL_DEBUG);
break;
case 'x':