summaryrefslogtreecommitdiff
path: root/indra/llcommon/llerrorcontrol.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/llerrorcontrol.h')
-rwxr-xr-xindra/llcommon/llerrorcontrol.h39
1 files changed, 25 insertions, 14 deletions
diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h
index 480654b1a2..56ac52e5de 100755
--- a/indra/llcommon/llerrorcontrol.h
+++ b/indra/llcommon/llerrorcontrol.h
@@ -29,7 +29,10 @@
#define LL_LLERRORCONTROL_H
#include "llerror.h"
+#include "llpointer.h"
+#include "llrefcount.h"
#include "boost/function.hpp"
+#include "boost/shared_ptr.hpp"
#include <string>
class LLSD;
@@ -136,26 +139,34 @@ namespace LLError
{
// An object that handles the actual output or error messages.
public:
+ Recorder();
virtual ~Recorder();
virtual void recordMessage(LLError::ELevel, const std::string& message) = 0;
// use the level for better display, not for filtering
- virtual bool wantsTime(); // default returns false
- // override and return true if the recorder wants the time string
- // included in the text of the message
+ bool wantsTime();
+ bool wantsTags();
+ bool wantsLevel();
+ bool wantsLocation();
+ bool wantsFunctionName();
+
+ protected:
+ bool mWantsTime,
+ mWantsTags,
+ mWantsLevel,
+ mWantsLocation,
+ mWantsFunctionName;
};
+ typedef boost::shared_ptr<Recorder> RecorderPtr;
+
/**
- * @NOTE: addRecorder() conveys ownership to the underlying Settings
- * object -- when destroyed, it will @em delete the passed Recorder*!
- */
- LL_COMMON_API void addRecorder(Recorder*);
- /**
- * @NOTE: removeRecorder() reclaims ownership of the Recorder*: its
- * lifespan becomes the caller's problem.
+ * @NOTE: addRecorder() and removeRecorder() uses the boost::shared_ptr to allow for shared ownership
+ * while still ensuring that the allocated memory is eventually freed
*/
- LL_COMMON_API void removeRecorder(Recorder*);
+ LL_COMMON_API void addRecorder(RecorderPtr);
+ LL_COMMON_API void removeRecorder(RecorderPtr);
// each error message is passed to each recorder via recordMessage()
LL_COMMON_API void logToFile(const std::string& filename);
@@ -172,9 +183,9 @@ namespace LLError
Utilities for use by the unit tests of LLError itself.
*/
- class Settings;
- LL_COMMON_API Settings* saveAndResetSettings();
- LL_COMMON_API void restoreSettings(Settings *);
+ typedef LLPointer<LLRefCount> SettingsStoragePtr;
+ LL_COMMON_API SettingsStoragePtr saveAndResetSettings();
+ LL_COMMON_API void restoreSettings(SettingsStoragePtr pSettingsStorage);
LL_COMMON_API std::string abbreviateFile(const std::string& filePath);
LL_COMMON_API int shouldLogCallCount();