Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    6b70493d
    DRTVWR-476: Make test program --debug switch work like LOGTEST=DEBUG. · 6b70493d
    Nat Goodspeed authored
    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.
    6b70493d
    History
    DRTVWR-476: Make test program --debug switch work like LOGTEST=DEBUG.
    Nat Goodspeed authored
    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.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
llerrorcontrol.h 6.65 KiB