📄 logtask.hpp
字号:
/*** *** See the file "L2_RTI_EO1/disclaimers-and-notices-L2.txt" for *** information on usage and redistribution of this file, *** and for a DISCLAIMER OF ALL WARRANTIES. ***/#ifndef LOG_HANDLER_H#define LOG_HANDLER_H#include <stdio.h>#include "SCL2L2Interface.h"// LSB 05JAN04 begin#include "LogFile.hpp"// LSB 05JAN04 end/** * Method processLogEvents() runs in its own task. This task receives messages * from all other tasks (via the Logging API) and in response writes the log * message to the specified log file. * There must be only one instance of this class. Because of the need for the * destructor to delete its class, and the need to avoid dynamic memory * allocation, it can not be made to use the Singleton design pattern. * The public member function processLogEvents() is run in its own process. * \ingroup RTI */// The maximum number of bytes for a log file other than .log.#define MAX_FILE_SIZE (64*1024) // Use 64k for flight.// The maximum number of versions which may exist, for each class of log file// other than .log files.#define MAX_VERSIONS 2// The maximum number of bytes for a .log file.#define MAX_LOG_SIZE (128*1024) // The maximum number of versions which may exist, for a .log file.#define LOG_VERSIONS 3class LogTask {public: /** The pathname of the reporter log file. */ static const char* const L2_LOG_PATHNAME; /** The pathname of the error log file. */ static const char* const L2_ERR_PATHNAME; /** The pathname of the debug log file. */ static const char* const L2_DBG_PATHNAME; /** The pathname of the scenario log file. */ static const char* const L2_SCR_PATHNAME;public: /** Default constructor. */ LogTask(); /** Dequeue and dispatch enqueued messages. */ void processLogEvents( void ); /** The destructor. */ ~LogTask();private: /** Close all LogFile data members. */ void closeLogFiles(void); /** * Dispatch enqueued messages. * \param logMsg an object containing a message for the logger * \return whether the LogTask is still running */ bool writeToDisk(const LOG_MSG& logMsg); /** Close the LogFile. */ void close(LogFile& logFile);private: /** Data about the reporter log file. */ LogFile d_rptLogFile; /** Data about the scenario log file. */ LogFile d_scrLogFile; /** Data about the error log file. */ LogFile d_errLogFile; /** Data about the debug log file. */ LogFile d_dbgLogFile; // invoke destructor last, so close last};#endif // LOG_HANDLER_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -