⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 warlogengine.h

📁 ftpserver very good sample
💻 H
字号:
/** Logger object * *  Construct one such object in a application that use *  the logging classes. */#ifndef WAR_LOG_ENGINE_H#define WAR_LOG_ENGINE_H/* SYSTEM INCLUDES */#ifndef WAR_LIST_INCLUDED#   define WAR_LIST_INCLUDED#   include <list>#endif/* PROJECT INCLUDES */#ifndef WAR_PTR_WRAPPER_H#   include "WarPtrWrapper.h"#endif#ifndef WAR_LOG_EVENT_HANDLER_H#   include "WarLogEventHandler.h"#endif#ifndef WAR_EXCEPTION_H#   include "WarException.h"#endif#ifndef WAR_CRITICAL_SECTION_H#   include "WarCriticalSection.h"#endif#ifndef WAR_LOG_THREAD_H#   include "WarLogThread.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarLogEngine {public:    ///    typedef std::list<WarPtrWrapper < WarLogEvent> >         LogEventList;    ///    typedef std::list<WarPtrWrapper < WarLogEventHandler> >         LogHandlerList;    typedef WarPtrWrapper<WarLogThread> thread_ptr_t;    // LIFECYCLE        /**    * Default constructor.    *    * Note that there can only be one of this object     * in an application    */    WarLogEngine(void) throw(WarException);            /**    * Destructor.    */    ~WarLogEngine(void);        // OPERATORS    // OPERATIONS    void LogEvent(WarLogEvent* plogEvent);    void StartDelayedLogging();    void SetRelaxMode(war_ccstr_t name,         war_uint32_t mode = WarLogEventHandler::SUPRESS_PREFIX,        bool doRelax = true) throw(WarException);    /// Installs a log-handler    void InstallHandler(WarLogEventHandler *pHandler) throw(WarException);    /// Removes a log-handler    void RemoveHandler(war_ccstr_t name) throw(WarException);    /// Set or clear a log event type    void EnableEvent(war_ccstr_t handlerName,        WarLogEventTypeE eventType,         bool doEnable = true)        throw(WarException);    /** Enable or disable one or more events, based on       * their names.      */    void EnableEvent(war_ccstr_t handlerName,        war_ccstr_t eventString,         bool doEnable = true)        throw(WarException);    // ACCESS    inline static WarLogEngine& GetEngine() throw(WarException)    {        if (!mpMe)            WarThrow(WarError(WAR_ERR_INTERNAL_DATA_NOT_INITIALIZED), NULL);        return *mpMe;    }    // INQUIRY    std::string Explain();    /// Check if any handler is processing an event    inline bool IsEventInUse(        const WarLogEventTypeE logEvent) const    {        return WARLOG_ISSET(msActiveEvents, logEvent);    }    const static war_ccstr_t msEventNames[WARLOG_INVALID +1];    static bool IsPresent()    {        return (NULL != mpMe);    }    protected:    friend class WarLogThread;    WarCriticalSection mLock;    thread_ptr_t mLogThreadPtr;    void OnLogEvent(war_logevent_ptr_t& logEventPtr);private:    WarLogEventHandler *FindHandler(war_ccstr_t name) throw(WarException);    LogHandlerList::iterator WarLogEngine::FindHandlerIterator(            war_ccstr_t name) throw(WarException);    void RecalcEventsInUse();    war_uint32_t msActiveEvents; // Log event types that are handled by the installed handlers    LogEventList msEvents;    LogHandlerList msHandlers;    static WarLogEngine* mpMe;};/* INLINE METHODS *//* EXTERNAL REFERENCES */#define WAR_IS_LOGEVENT_IN_USE(ev) \    WarLogEngine::GetEngine().IsEventInUse(ev)#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* _WAR_LOG_ENGINE_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -