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

📄 rvlog.h

📁 基于h323协议的软phone
💻 H
📖 第 1 页 / 共 2 页
字号:
/********************************************************************************************
 * RvLogGetSourceByName
 *
 * purpose : Get the source for a specific log source name
 * input   : logMgr     - Log manager
 *           libraryCode- Library code number this source is in (RV_LOG_LIBCODE_CBASE for example)
 *           name       - Name of the source to find
 * output  : source     - Source found on success
 * return  : RV_OK on success, other on failure
 ********************************************************************************************/
RVCOREAPI RvStatus RVCALLCONV RvLogGetSourceByName(
    IN  RvLogMgr*       logMgr,
    IN  RvUint32        libraryCode,
    IN  const RvChar*   name,
    OUT RvLogSource*    source);


/********************************************************************************************
 * RvLogIsSelected
 *
 * purpose : Check to see if a specific message type should be sent to the log by a given
 *           source
 * input   : source         - Source of message to log
 *           messageType    - Type of the message to log
 * output  : None
 * return  : RV_TRUE if message should be logged, RV_FALSE otherwise
 ********************************************************************************************/
RVCOREAPI
RvBool RVCALLCONV RvLogIsSelected(
    IN RvLogSource*     source,
    IN RvLogMessageType messageType);


/********************************************************************************************
 * RvLogSetLevel
 *
 * purpose : Set the level of logging, while leaving the masks of all log sources without a
 *           change.
 * input   : logMgr - Log manager
 *           level  - 0 stop logging, 1 log by the masks of the sources, 2 log everything
 * output  : None
 * return  : RV_OK on success, other on failure
 ********************************************************************************************/
RVCOREAPI
RvStatus RVCALLCONV RvLogSetLevel(
    IN RvLogMgr*    logMgr,
    IN RvInt32      level);


/********************************************************************************************
 * RvLogSetGlobalMask
 *
 * purpose : Set the mask of messages to log on all the sources of the log object
 * input   : logMgr         - Log manager
 *           messageMask    - Type of the messages to log
 * output  : None
 * return  : RV_OK on success, other on failure
 ********************************************************************************************/
RVCOREAPI
RvStatus RVCALLCONV RvLogSetGlobalMask(
    IN RvLogMgr*        logMgr,
    IN RvLogMessageType messageMask);


/********************************************************************************************
 * RvLogSourceSetMask
 *
 * purpose : Set the mask of messages to log for a specific source
 * input   : source         - Source of messages to set
 *           messageMask    - Type of the messages to log
 * output  : None
 * return  : RV_OK on success, other on failure
 ********************************************************************************************/
RVCOREAPI
RvStatus RVCALLCONV RvLogSourceSetMask(
    IN RvLogSource*     source,
    IN RvLogMessageType messageMask);


/********************************************************************************************
 * RvLogSourceGetMask
 *
 * purpose : Get the mask of messages to log for a specific source
 * input   : source         - Source of messages to get
 * output  : None
 * return  : Message mask of messages that are logged
 ********************************************************************************************/
RVCOREAPI
RvLogMessageType RVCALLCONV RvLogSourceGetMask(
    IN RvLogSource*     source);


/********************************************************************************************
 * RvLogSourceGetName
 *
 * purpose : Get the name for a specific log source
 * input   : source         - Source of messages to get
 * output  : None
 * return  : Name of the source on success, NULL on failure
 ********************************************************************************************/
RVCOREAPI const RvChar* RVCALLCONV RvLogSourceGetName(
    IN RvLogSource*     source);


/********************************************************************************************
 * RvLogXXX
 *
 * purpose : Log a text message with variable amount of arguments, to the relevant
 *           logging level.
 *           These macros should be used and not RvLogTextXXX functions!
 * input   : source     - Source of message to log
 *           line       - Formatted string to log
 * output  : None
 * return  : None
 * example : RvLogDebug((RvLogSource*)source, ((RvLogSource*)source, "Example %d", i));
 ********************************************************************************************/
#define RvLogExcep(source, funcParams) \
    if (RvLogIsSelected(source, RV_LOGLEVEL_EXCEP)) RvLogTextExcep funcParams;else;
RVCOREAPI
RvStatus RVCALLCONV RvLogTextExcep(
    IN  RvLogSource*        source,
    IN  const char*         line, ...);

#define RvLogError(source, funcParams) \
    if (RvLogIsSelected(source, RV_LOGLEVEL_ERROR)) RvLogTextError funcParams;else;
RVCOREAPI
RvStatus RVCALLCONV RvLogTextError(
    IN  RvLogSource*        source,
    IN  const char*         line, ...);

#define RvLogWarning(source, funcParams) \
    if (RvLogIsSelected(source, RV_LOGLEVEL_WARNING)) RvLogTextWarning funcParams;else;
RVCOREAPI
RvStatus RVCALLCONV RvLogTextWarning(
    IN  RvLogSource*        source,
    IN  const char*         line, ...);

#define RvLogInfo(source, funcParams) \
    if (RvLogIsSelected(source, RV_LOGLEVEL_INFO)) RvLogTextInfo funcParams;else;
RVCOREAPI
RvStatus RVCALLCONV RvLogTextInfo(
    IN  RvLogSource*        source,
    IN  const char*         line, ...);

#define RvLogDebug(source, funcParams) \
    if (RvLogIsSelected(source, RV_LOGLEVEL_DEBUG)) RvLogTextDebug funcParams;else;
RVCOREAPI
RvStatus RVCALLCONV RvLogTextDebug(
    IN  RvLogSource*        source,
    IN  const char*         line, ...);

#define RvLogEnter(source, funcParams) \
    if (RvLogIsSelected(source, RV_LOGLEVEL_ENTER)) RvLogTextEnter funcParams;else;
RVCOREAPI
RvStatus RVCALLCONV RvLogTextEnter(
    IN  RvLogSource*        source,
    IN  const char*         line, ...);

#define RvLogLeave(source, funcParams) \
    if (RvLogIsSelected(source, RV_LOGLEVEL_LEAVE)) RvLogTextLeave funcParams;else;
RVCOREAPI
RvStatus RVCALLCONV RvLogTextLeave(
    IN  RvLogSource*        source,
    IN  const char*         line, ...);



/********************************************************************************************
 * RvLogRecordGetXXX
 *
 * purpose : Retreives specific informatino from a log record. This set of functions should
 *           be used inside the listener functions when messages have to be logged.
 * input   : logRecord  - Log record to check
 * output  : None
 * return  : Desired field
 ********************************************************************************************/
#define RvLogRecordGetTimestamp(logRecord) ((logRecord)->timestamp)
#define RvLogRecordGetThread(logRecord) ((logRecord)->threadInfo)
#define RvLogRecordGetSource(logRecord) ((logRecord)->source)
#define RvLogRecordGetMessageType(logRecord) ((logRecord)->messageType)
#define RvLogRecordGetText(logRecord) ((logRecord)->text)








/* The checks below removes functions and macros by the specified log mask we're using.
   This allows us to compile the code with partial logging (for example, only compile with
   error messages being able to log) */

#if (!(RV_LOGMASK_COMPILEMASK & RV_LOGLEVEL_EXCEP))
#undef RvLogExcep
#undef RvLogTextExcep
#define RvLogTextExcep
#define RvLogExcep(source, funcParams)
#endif

#if (!(RV_LOGMASK_COMPILEMASK & RV_LOGLEVEL_ERROR))
#undef RvLogError
#undef RvLogTextError
#define RvLogTextError
#define RvLogError(source, funcParams)
#endif

#if (!(RV_LOGMASK_COMPILEMASK & RV_LOGLEVEL_WARNING))
#undef RvLogWarning
#undef RvLogTextWarning
#define RvLogTextWarning
#define RvLogWarning(source, funcParams)
#endif

#if (!(RV_LOGMASK_COMPILEMASK & RV_LOGLEVEL_INFO))
#undef RvLogInfo
#undef RvLogTextInfo
#define RvLogTextInfo
#define RvLogInfo(source, funcParams)
#endif

#if (!(RV_LOGMASK_COMPILEMASK & RV_LOGLEVEL_DEBUG))
#undef RvLogDebug
#undef RvLogTextDebug
#define RvLogTextDebug
#define RvLogDebug(source, funcParams)
#endif

#if (!(RV_LOGMASK_COMPILEMASK & RV_LOGLEVEL_ENTER))
#undef RvLogEnter
#undef RvLogTextEnter
#define RvLogTextEnter
#define RvLogEnter(source, funcParams)
#endif

#if (!(RV_LOGMASK_COMPILEMASK & RV_LOGLEVEL_LEAVE))
#undef RvLogLeave
#undef RvLogTextLeave
#define RvLogTextLeave
#define RvLogLeave(source, funcParams)
#endif


#if (RV_LOGMASK_COMPILEMASK == 0)
#undef RvLogIsSelected
#define RvLogIsSelected(source, messageType) RV_FALSE
#endif






#if defined(__cplusplus)
}
#endif

#endif /* RV_LOG_H */

⌨️ 快捷键说明

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