#ifndef _apl_logging_xslogapi_h_ #define _apl_logging_xslogapi_h_ /*---------------------------------------------------------------------------- ** SUMMARY: Extra Small Logging API (XSLOG) ** ** DESCRIPTION: ** This file provides very small and generic interface for logging application ** messages. The interface assumes that the platform does not have or can ** incur the overhead of the C printf rouintes. Where and how the information ** is 'logged' is platform dependent. ** ** CONFIGURATION ** ------------- ** COMPILE: none. ** ** APPLICATION: none. ** ** PLATFORM: none. ** ** NOTES: ** 1. Unless explicitly stated, NONE of the following methods may be called ** from interrtup service routines. ** 2. 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/types/types.h" /* For: basic types */ #include "platform/xslogapi.h" /* For: platform implementation */ #ifdef __cplusplus extern "C" { #endif /*-------------- ERRORS ----------------------------------------------------*/ /***/ #define APL_ERRSTR_XSLOG_LOGGING_OPERATION_FAILED "XSLOG: Error while attempting to log data." /***/ #define APL_ERR_XSLOG_LOGGING_OPERATION_FAILED _APL_ERR_XSLOG_LOGGING_OPERATION_FAILED /*-------------- PUBLIC/PUBLISHED API --------------------------------------*/ /** This method is to inform the logging engine that a new log message is being started. All log messages are made up of one or more calls to the the individual log methods. The 'start' and 'end' methods are required for the logging engine to properly delineate log messages. Prototype: void Apl_xsLogMsgStart(void); */ #define Apl_xsLogMsgStart _Apl_xsLogMsgStart /** This method is to inform the logging engine that current log message has been complted. Prototype: void Apl_xsLogMsgEnd(void); */ #define Apl_xsLogMsgEnd _Apl_xsLogMsgEnd /*-------------- PUBLIC/PUBLISHED API --------------------------------------*/ /** This method outputs the null terminated string to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLog(const char* logMsg); */ #define Apl_xsLog _Apl_xsLog /** This method outputs the null terminated string and the associated 8bit value to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLog8(const char* logMsg, Apl8u binData ); */ #define Apl_xsLog8 _Apl_xsLog8 /** This method outputs the null terminated string and the associated 16bit value to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLog16(const char* logMsg, Apl16u binData ); */ #define Apl_xsLog16 _Apl_xsLog16 /** This method outputs the null terminated string and the associated 32bit value to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLog32(const char* logMsg, Apl32u binData ); */ #define Apl_xsLog32 _Apl_xsLog32 /** This method outputs the null terminated string and the associated pointer value to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLogPtr(const char* logMsg, void* pointerToLog ); */ #define Apl_xsLogPtr _Apl_xsLogPtr /** This method outputs the null terminated string and the associated AplSize_t value to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLogSizeT(const char* logMsg, AplSize_t binData ); */ #define Apl_xsLogSizeT _Apl_xsLogSizeT /** This method outputs the null terminated string and the associated AplSSize_t value to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLogSSizeT(const char* logMsg, AplSSize_t binData ); */ #define Apl_xsLogSSizeT _Apl_xsLogSSizeT /** This method outputs the null terminated string and the associated AplWord value to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLogWord(const char* logMsg, AplWord binData ); */ #define Apl_xsLogWord _Apl_xsLogWord /** This method outputs the null terminated string and the associated AplDWord value to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLogDWord(const char* logMsg, AplDWord binData ); */ #define Apl_xsLogDWord _Apl_xsLogDWord /** This method outputs the null terminated string and the associated null terminated string value to the logging media. The final formatting of the data is platform dependent. Prototype: void Apl_xsLogStr(const char* logMsg, const char* strData ); */ #define Apl_xsLogStr _Apl_xsLogStr /*-------------- PUBLIC/PUBLISHED API --------------------------------------*/ /** The following macros are some helpful short-hand macros for generating logging messages. */ /***/ #define APL_XSLOG(msg) {Apl_xsLogMsgStart(); Apl_xsLog(msg); Apl_xsLogMsgEnd();} /***/ #define APL_XSLOG_STR1(msg1,strval1) {Apl_xsLogMsgStart(); Apl_xsLogStr(msg1, strval1); Apl_xsLogMsgEnd();} /***/ #define APL_XSLOG_STR2(msg1,strval1,msg2,strval2) {Apl_xsLogMsgStart(); Apl_xsLogStr(msg1, strval1); Apl_xsLogStr(msg2, strval2); Apl_xsLogMsgEnd();} /***/ #define APL_XSLOG_STR3(m1,s1,m2,s2,m3,s3) {Apl_xsLogMsgStart(); Apl_xsLogStr(m1, s1); Apl_xsLogStr(m2, s2); Apl_xsLogStr(m3, s3); Apl_xsLogMsgEnd();} /***/ #define APL_XSLOG_STR4(m1,s1,m2,s2,m3,s3,m4,s4) {Apl_xsLogMsgStart(); Apl_xsLogStr(m1, s1); Apl_xsLogStr(m2, s2); Apl_xsLogStr(m3, s3); Apl_xsLogStr(m4, s4); Apl_xsLogMsgEnd();} /***/ #define APL_XSLOG_BIN1(msg1,binval1) {Apl_xsLogMsgStart(); Apl_xsLog32(msg1, (Apl32u)binval1); Apl_xsLogMsgEnd();} /***/ #define APL_XSLOG_BIN2(msg1,binval1,msg2,binval2) {Apl_xsLogMsgStart(); Apl_xsLog32(msg1, (Apl32u)binval1); Apl_xsLog32(msg2, (Apl32u)binval2); Apl_xsLogMsgEnd();} /***/ #define APL_XSLOG_BIN3(m1,b1,m2,b2,m3,b3) {Apl_xsLogMsgStart(); Apl_xsLog32(m1, (Apl32u)b1); Apl_xsLog32(m2, (Apl32u)b2); Apl_xsLog32(m3, (Apl32u)b3); Apl_xsLogMsgEnd();} /***/ #define APL_XSLOG_BIN4(m1,b1,m2,b2,m3,b3,m4,b4) {Apl_xsLogMsgStart(); Apl_xsLog32(m1, (Apl32u)b1); Apl_xsLog32(m2, (Apl32u)b2); Apl_xsLog32(m3, (Apl32u)b3); Apl_xsLog32(m4, (Apl32u)b4);Apl_xsLogMsgEnd();} /***/ #define APL_XSLOG_STR1BIN1(msg1,strval1,msg2,binval1) {Apl_xsLogMsgStart(); Apl_xsLogStr(msg1, strval1); Apl_xsLog32(msg2, binval1); Apl_xsLogMsgEnd();} #ifdef __cplusplus } #endif /*--------------------------------------------------------------------------*/ #endif /* end _apl_logging_xslogapi_h_ */