#ifndef _aplmt_logging_xslogapi_h_ #define _aplmt_logging_xslogapi_h_ /*---------------------------------------------------------------------------- ** SUMMARY: Thread Safe Extra Small Logging API (XSLOGMT) ** ** DESCRIPTION: ** This file provides extends the original XSLOG interface to be thread ** aware. In addition, it provides a thread-safe implementation of the ** original XSLOG interface. ** ** CONFIGURATION ** ------------- ** COMPILE: none. ** ** APPLICATION: none. ** ** PLATFORM: none. ** ** NOTES: ** 1. Unless explicitly stated otherwise, NONE of the following methods may be ** called from interrupt service routines. ** 2. Unless explicitly stated otherwise, NONE of the following methods may be ** called before the platform's kernel is running. ** 3. Unless explicitly stated otherwise, all of the following methods ARE ** thread-safe. ** 4. For efficency/optimization some methods are 'inlined'. The inlining ** is done by using the preprocessor/macros. The application should ** treat all methods as function calls and not rely on the fact they may ** be currently defined as macros. ----------------------------------------------------------------------------*/ #include "apl/logging/xslogapi.h" /* For: parent/base interface */ #ifdef __cplusplus extern "C" { #endif /*-------------- INHERITED PARENT API --------------------------------------*/ /** The parent/base API methods are enumerated below. All of the following methods are available with this interface and are thread-safe. For a up-to-date list reference the parent class directly. Prototypes: void Apl_xsLogMsgStart(void); void Apl_xsLogMsgEnd(void); void Apl_xsLog(const char* logMsg); void Apl_xsLog8(const char* logMsg, Apl8u binData ); void Apl_xsLog16(const char* logMsg, Apl16u binData ); void Apl_xsLog32(const char* logMsg, Apl32u binData ); void Apl_xsLogPtr(const char* logMsg, void* pointerToLog ); void Apl_xsLogSizeT(const char* logMsg, AplSize_t binData ); void Apl_xsLogSSizeT(const char* logMsg, AplSSize_t binData ); void Apl_xsLogWord(const char* logMsg, AplWord binData ); void Apl_xsLogDWord(const char* logMsg, AplDWord binData ); void Apl_xsLogStr(const char* logMsg, const char* strData ); */ /*-------------- PUBLIC/PUBLISHED API --------------------------------------*/ /** This method outputs the system's current time and the specified null terminated string to the logging media. The resolution of the system time and the final formatting of the data is platform dependent. NOTES: o This method can only be called from a thread and/or context that supports the APL "System Primitives Interfaces (SYSMT)", since it uses the method Aplmt_getSystemTimeMsec() as the source of the system time. Prototype: void Aplmt_xsLogSysTime(const char* logMsg); */ #define Aplmt_xsLogSysTime _Aplmt_xsLogSysTime /** This method outputs the current thread ID and the specified null terminated string to the logging media. The nature of the thread ID time and the final formatting of the data is platform dependent. NOTES: o This method is guarentied to the log the specified message string, even if the system is not multi-threaded. o When running in multi-threaded environment, this method can only be called from a thread that was created using the APL create thread interface. Prototype: void Aplmt_xsLogThread(const char* logMsg); */ #define Aplmt_xsLogThread _Aplmt_xsLogThread /*-------------- PUBLIC/PUBLISHED API --------------------------------------*/ /** The following macros are some helpful short-hand macros for generating logging messages. All of the log message will be prefixed with the current thread "ID". */ /***/ #define APLMT_XSLOG(msg) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLog(msg); Apl_xsLogMsgEnd();} /***/ #define APLMT_XSLOG_STR1(msg1,strval1) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLogStr(msg1, strval1); Apl_xsLogMsgEnd();} /***/ #define APLMT_XSLOG_STR2(msg1,strval1,msg2,strval2) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLogStr(msg1, strval1); Apl_xsLogStr(msg2, strval2); Apl_xsLogMsgEnd();} /***/ #define APLMT_XSLOG_STR3(m1,s1,m2,s2,m3,s3) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLogStr(m1, s1); Apl_xsLogStr(m2, s2); Apl_xsLogStr(m3, s3); Apl_xsLogMsgEnd();} /***/ #define APLMT_XSLOG_STR4(m1,s1,m2,s2,m3,s3,m4,s4) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLogStr(m1, s1); Apl_xsLogStr(m2, s2); Apl_xsLogStr(m3, s3); Apl_xsLogStr(m4, s4); Apl_xsLogMsgEnd();} /***/ #define APLMT_XSLOG_BIN1(msg1,binval1) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLog32(msg1, (Apl32u)binval1); Apl_xsLogMsgEnd();} /***/ #define APLMT_XSLOG_BIN2(msg1,binval1,msg2,binval2) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLog32(msg1, (Apl32u)binval1); Apl_xsLog32(msg2, (Apl32u)binval2); Apl_xsLogMsgEnd();} /***/ #define APLMT_XSLOG_BIN3(m1,b1,m2,b2,m3,b3) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLog32(m1, (Apl32u)b1); Apl_xsLog32(m2, (Apl32u)b2); Apl_xsLog32(m3, (Apl32u)b3); Apl_xsLogMsgEnd();} /***/ #define APLMT_XSLOG_BIN4(m1,b1,m2,b2,m3,b3,m4,b4) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLog32(m1, (Apl32u)b1); Apl_xsLog32(m2, (Apl32u)b2); Apl_xsLog32(m3, (Apl32u)b3); Apl_xsLog32(m4, (Apl32u)b4);Apl_xsLogMsgEnd();} /***/ #define APLMT_XSLOG_STR1BIN1(msg1,strval1,msg2,binval1) {Apl_xsLogMsgStart(); Aplmt_xsLogThread(""); Apl_xsLogStr(msg1, strval1); Apl_xsLog32(msg2, binval1); Apl_xsLogMsgEnd();} #ifdef __cplusplus } #endif /*--------------------------------------------------------------------------*/ #endif /* end _apl_logging_xslogapi_h_ */