📄 logging.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 LOGGING_H#define LOGGING_H#include "SCL2L2Interface.h"#include <stdio.h>/** The upper bound for the length of a log message's text. */#define MAX_MSG_LENGTH 500/** * Messages to the logger are objects of class LOG_MSG. * Making this an inner class will require too many changes. * -- WARNING -- * If the size of LOG_MSG changes, you *must* change the definition of * L2RTI_TO_LOG_MSG_SIZE in "SCL2L2Interface.h". * \ingroup RTI */class LOG_MSG {public: unsigned int msgType; char msg[MAX_MSG_LENGTH];};/** * Clients call log() to enqueue a LOG_MSG for a handler that writes the * message string to a file; or sendToTelemetry() to enqueue an L2ResultMsg * for SCL. * \ingroup RTI */class Logging { public: /** * Opcode for dequeued messages, signifying either the log file to which * the message is sent, or that the LogTask should exit. */ enum logType { L2_LOG, L2_DEBUG, L2_ERROR, L2_SCRIPT, LOG_EXIT }; private: /** * The constructor is private -- and not defined -- because all member * functions are static and there are no data members. Therefore, there is * no need to create an instance. */ Logging(); public: /** * Send the message to SCL. * \param l2ResultMsg the message object to send to SCL */ static void sendToTelemetry(const L2ResultMsg& l2ResultMsg); /** * Send the message to standard output and/or a disk file. * \param type specifies the file to which the message is sent * \param message a C string which is the message to log */ static void log(logType type, const char *message); private: /** * Enqueue the message to the logger. * \param logMsg an object containing the log message */ static void sendToDisk(const LOG_MSG& logMsg); private:};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -