diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
---|---|---|
committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
commit | 1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch) | |
tree | ab243607f74f78200787bba5b9b88f07ef1b966f /indra/llcommon/llerrorcontrol.h | |
parent | 6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff) | |
parent | e1623bb276f83a43ce7a197e388720c05bdefe61 (diff) |
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
# autobuild.xml
# indra/cmake/CMakeLists.txt
# indra/cmake/GoogleMock.cmake
# indra/llaudio/llaudioengine_fmodstudio.cpp
# indra/llaudio/llaudioengine_fmodstudio.h
# indra/llaudio/lllistener_fmodstudio.cpp
# indra/llaudio/lllistener_fmodstudio.h
# indra/llaudio/llstreamingaudio_fmodstudio.cpp
# indra/llaudio/llstreamingaudio_fmodstudio.h
# indra/llcharacter/llmultigesture.cpp
# indra/llcharacter/llmultigesture.h
# indra/llimage/llimage.cpp
# indra/llimage/llimagepng.cpp
# indra/llimage/llimageworker.cpp
# indra/llimage/tests/llimageworker_test.cpp
# indra/llmessage/tests/llmockhttpclient.h
# indra/llprimitive/llgltfmaterial.h
# indra/llrender/llfontfreetype.cpp
# indra/llui/llcombobox.cpp
# indra/llui/llfolderview.cpp
# indra/llui/llfolderviewmodel.h
# indra/llui/lllineeditor.cpp
# indra/llui/lllineeditor.h
# indra/llui/lltextbase.cpp
# indra/llui/lltextbase.h
# indra/llui/lltexteditor.cpp
# indra/llui/lltextvalidate.cpp
# indra/llui/lltextvalidate.h
# indra/llui/lluictrl.h
# indra/llui/llview.cpp
# indra/llwindow/llwindowmacosx.cpp
# indra/newview/app_settings/settings.xml
# indra/newview/llappearancemgr.cpp
# indra/newview/llappearancemgr.h
# indra/newview/llavatarpropertiesprocessor.cpp
# indra/newview/llavatarpropertiesprocessor.h
# indra/newview/llbreadcrumbview.cpp
# indra/newview/llbreadcrumbview.h
# indra/newview/llbreastmotion.cpp
# indra/newview/llbreastmotion.h
# indra/newview/llconversationmodel.h
# indra/newview/lldensityctrl.cpp
# indra/newview/lldensityctrl.h
# indra/newview/llface.inl
# indra/newview/llfloatereditsky.cpp
# indra/newview/llfloatereditwater.cpp
# indra/newview/llfloateremojipicker.h
# indra/newview/llfloaterimsessiontab.cpp
# indra/newview/llfloaterprofiletexture.cpp
# indra/newview/llfloaterprofiletexture.h
# indra/newview/llgesturemgr.cpp
# indra/newview/llgesturemgr.h
# indra/newview/llimpanel.cpp
# indra/newview/llimpanel.h
# indra/newview/llinventorybridge.cpp
# indra/newview/llinventorybridge.h
# indra/newview/llinventoryclipboard.cpp
# indra/newview/llinventoryclipboard.h
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorygallery.cpp
# indra/newview/lllistbrowser.cpp
# indra/newview/lllistbrowser.h
# indra/newview/llpanelobjectinventory.cpp
# indra/newview/llpanelprofile.cpp
# indra/newview/llpanelprofile.h
# indra/newview/llpreviewgesture.cpp
# indra/newview/llsavedsettingsglue.cpp
# indra/newview/llsavedsettingsglue.h
# indra/newview/lltooldraganddrop.cpp
# indra/newview/llurllineeditorctrl.cpp
# indra/newview/llvectorperfoptions.cpp
# indra/newview/llvectorperfoptions.h
# indra/newview/llviewerparceloverlay.cpp
# indra/newview/llviewertexlayer.cpp
# indra/newview/llviewertexturelist.cpp
# indra/newview/macmain.h
# indra/test/test.cpp
Diffstat (limited to 'indra/llcommon/llerrorcontrol.h')
-rw-r--r-- | indra/llcommon/llerrorcontrol.h | 322 |
1 files changed, 161 insertions, 161 deletions
diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 77b187a80f..bf5a6df556 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -38,143 +38,143 @@ class LLSD; /* - This is the part of the LLError namespace that manages the messages - produced by the logging. The logging support is defined in llerror.h. - Most files do not need to include this. + This is the part of the LLError namespace that manages the messages + produced by the logging. The logging support is defined in llerror.h. + Most files do not need to include this. - These implementations are in llerror.cpp. + These implementations are in llerror.cpp. */ // Line buffer interface class LLLineBuffer { public: - LLLineBuffer() {}; - virtual ~LLLineBuffer() {}; + LLLineBuffer() {}; + virtual ~LLLineBuffer() {}; - virtual void clear() = 0; // Clear the buffer, and reset it. + virtual void clear() = 0; // Clear the buffer, and reset it. - virtual void addLine(const std::string& utf8line) = 0; + virtual void addLine(const std::string& utf8line) = 0; }; namespace LLError { - LL_COMMON_API void initForApplication(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr = true); - // resets all logging settings to defaults needed by applicaitons - // logs to stderr and windows debug log - // sets up log configuration from the file logcontrol.xml in dir + LL_COMMON_API void initForApplication(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr = true); + // resets all logging settings to defaults needed by applicaitons + // logs to stderr and windows debug log + // sets up log configuration from the file logcontrol.xml in dir - /* - Settings that control what is logged. - Setting a level means log messages at that level or above. - */ + /* + Settings that control what is logged. + Setting a level means log messages at that level or above. + */ - LL_COMMON_API void setPrintLocation(bool); - LL_COMMON_API void setDefaultLevel(LLError::ELevel); - LL_COMMON_API ELevel getDefaultLevel(); - LL_COMMON_API void setAlwaysFlush(bool flush); + LL_COMMON_API void setPrintLocation(bool); + LL_COMMON_API void setDefaultLevel(LLError::ELevel); + LL_COMMON_API ELevel getDefaultLevel(); + LL_COMMON_API void setAlwaysFlush(bool flush); LL_COMMON_API bool getAlwaysFlush(); - LL_COMMON_API void setEnabledLogTypesMask(U32 mask); - LL_COMMON_API U32 getEnabledLogTypesMask(); - LL_COMMON_API void setFunctionLevel(const std::string& function_name, LLError::ELevel); - LL_COMMON_API void setClassLevel(const std::string& class_name, LLError::ELevel); - LL_COMMON_API void setFileLevel(const std::string& file_name, LLError::ELevel); - LL_COMMON_API void setTagLevel(const std::string& file_name, LLError::ELevel); - - LL_COMMON_API LLError::ELevel decodeLevel(std::string name); - LL_COMMON_API void configure(const LLSD&); - // the LLSD can configure all of the settings - // usually read automatically from the live errorlog.xml file - - - /* - Control functions. - */ - - typedef boost::function<void(const std::string&)> FatalFunction; - - LL_COMMON_API void setFatalFunction(const FatalFunction&); - // The fatal function will be called after an message of LEVEL_ERROR - // is logged. Note: supressing a LEVEL_ERROR message from being logged - // (by, for example, setting a class level to LEVEL_NONE), will keep - // that message from causing the fatal function to be invoked. - // The passed FatalFunction will be the LAST log function called - // before LL_ERRS crashes its caller. A FatalFunction can throw an - // exception, or call exit(), to bypass the crash. It MUST disrupt the - // flow of control because no caller expects LL_ERRS to return. - - LL_COMMON_API FatalFunction getFatalFunction(); - // Retrieve the previously-set FatalFunction - - LL_COMMON_API std::string getFatalMessage(); - // Retrieve the message last passed to FatalFunction, if any - - /// temporarily override the FatalFunction for the duration of a - /// particular scope, e.g. for unit tests - class LL_COMMON_API OverrideFatalFunction - { - public: - OverrideFatalFunction(const FatalFunction& func): - mPrev(getFatalFunction()) - { - setFatalFunction(func); - } - ~OverrideFatalFunction() - { - setFatalFunction(mPrev); - } - - private: - FatalFunction mPrev; - }; - - typedef std::string (*TimeFunction)(); - LL_COMMON_API std::string utcTime(); - - LL_COMMON_API void setTimeFunction(TimeFunction); - // The function is use to return the current time, formatted for - // display by those error recorders that want the time included. - - - - class LL_COMMON_API Recorder - { - // 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 enabled() { return true; } - - bool wantsTime(); - bool wantsTags(); - bool wantsLevel(); - bool wantsLocation(); - bool wantsFunctionName(); - bool wantsMultiline(); - - void showTime(bool show); - void showTags(bool show); - void showLevel(bool show); - void showLocation(bool show); - void showFunctionName(bool show); - void showMultiline(bool show); - - protected: - bool mWantsTime; - bool mWantsTags; - bool mWantsLevel; - bool mWantsLocation; - bool mWantsFunctionName; - bool mWantsMultiline; - }; - - typedef std::shared_ptr<Recorder> RecorderPtr; + LL_COMMON_API void setEnabledLogTypesMask(U32 mask); + LL_COMMON_API U32 getEnabledLogTypesMask(); + LL_COMMON_API void setFunctionLevel(const std::string& function_name, LLError::ELevel); + LL_COMMON_API void setClassLevel(const std::string& class_name, LLError::ELevel); + LL_COMMON_API void setFileLevel(const std::string& file_name, LLError::ELevel); + LL_COMMON_API void setTagLevel(const std::string& file_name, LLError::ELevel); + + LL_COMMON_API LLError::ELevel decodeLevel(std::string name); + LL_COMMON_API void configure(const LLSD&); + // the LLSD can configure all of the settings + // usually read automatically from the live errorlog.xml file + + + /* + Control functions. + */ + + typedef boost::function<void(const std::string&)> FatalFunction; + + LL_COMMON_API void setFatalFunction(const FatalFunction&); + // The fatal function will be called after an message of LEVEL_ERROR + // is logged. Note: supressing a LEVEL_ERROR message from being logged + // (by, for example, setting a class level to LEVEL_NONE), will keep + // that message from causing the fatal function to be invoked. + // The passed FatalFunction will be the LAST log function called + // before LL_ERRS crashes its caller. A FatalFunction can throw an + // exception, or call exit(), to bypass the crash. It MUST disrupt the + // flow of control because no caller expects LL_ERRS to return. + + LL_COMMON_API FatalFunction getFatalFunction(); + // Retrieve the previously-set FatalFunction + + LL_COMMON_API std::string getFatalMessage(); + // Retrieve the message last passed to FatalFunction, if any + + /// temporarily override the FatalFunction for the duration of a + /// particular scope, e.g. for unit tests + class LL_COMMON_API OverrideFatalFunction + { + public: + OverrideFatalFunction(const FatalFunction& func): + mPrev(getFatalFunction()) + { + setFatalFunction(func); + } + ~OverrideFatalFunction() + { + setFatalFunction(mPrev); + } + + private: + FatalFunction mPrev; + }; + + typedef std::string (*TimeFunction)(); + LL_COMMON_API std::string utcTime(); + + LL_COMMON_API void setTimeFunction(TimeFunction); + // The function is use to return the current time, formatted for + // display by those error recorders that want the time included. + + + + class LL_COMMON_API Recorder + { + // 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 enabled() { return true; } + + bool wantsTime(); + bool wantsTags(); + bool wantsLevel(); + bool wantsLocation(); + bool wantsFunctionName(); + bool wantsMultiline(); + + void showTime(bool show); + void showTags(bool show); + void showLevel(bool show); + void showLocation(bool show); + void showFunctionName(bool show); + void showMultiline(bool show); + + protected: + bool mWantsTime; + bool mWantsTags; + bool mWantsLevel; + bool mWantsLocation; + bool mWantsFunctionName; + bool mWantsMultiline; + }; + + typedef std::shared_ptr<Recorder> RecorderPtr; /** * Instantiate GenericRecorder with a callable(level, message) to get @@ -197,48 +197,48 @@ namespace LLError CALLABLE mCallable; }; - /** - * @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 addRecorder(RecorderPtr); - LL_COMMON_API void removeRecorder(RecorderPtr); - // each error message is passed to each recorder via recordMessage() - /** - * Call addGenericRecorder() with a callable(level, message) to get - * control on every log message without having to code an explicit - * Recorder subclass. Save the returned RecorderPtr if you later want to - * call removeRecorder(). - */ - template <typename CALLABLE> - RecorderPtr addGenericRecorder(const CALLABLE& callable) - { - RecorderPtr ptr{ new GenericRecorder<CALLABLE>(callable) }; - addRecorder(ptr); - return ptr; - } - - LL_COMMON_API void logToFile(const std::string& filename); - LL_COMMON_API void logToStderr(); - LL_COMMON_API void logToFixedBuffer(LLLineBuffer*); - // Utilities to add recorders for logging to a file or a fixed buffer - // A second call to the same function will remove the logger added - // with the first. - // Passing the empty string or NULL to just removes any prior. - LL_COMMON_API std::string logFileName(); - // returns name of current logging file, empty string if none - - - /* - Utilities for use by the unit tests of LLError itself. - */ - - 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(); + /** + * @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 addRecorder(RecorderPtr); + LL_COMMON_API void removeRecorder(RecorderPtr); + // each error message is passed to each recorder via recordMessage() + /** + * Call addGenericRecorder() with a callable(level, message) to get + * control on every log message without having to code an explicit + * Recorder subclass. Save the returned RecorderPtr if you later want to + * call removeRecorder(). + */ + template <typename CALLABLE> + RecorderPtr addGenericRecorder(const CALLABLE& callable) + { + RecorderPtr ptr{ new GenericRecorder<CALLABLE>(callable) }; + addRecorder(ptr); + return ptr; + } + + LL_COMMON_API void logToFile(const std::string& filename); + LL_COMMON_API void logToStderr(); + LL_COMMON_API void logToFixedBuffer(LLLineBuffer*); + // Utilities to add recorders for logging to a file or a fixed buffer + // A second call to the same function will remove the logger added + // with the first. + // Passing the empty string or NULL to just removes any prior. + LL_COMMON_API std::string logFileName(); + // returns name of current logging file, empty string if none + + + /* + Utilities for use by the unit tests of LLError itself. + */ + + 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(); }; #endif // LL_LLERRORCONTROL_H |