📄 rvlog.h
字号:
#if (0)
************************************************************************
Filename:
Description:
************************************************************************
Copyright (c) 1999 RADVision Inc.
************************************************************************
NOTICE:
This document contains information that is proprietary to RADVision LTD.
No part of this publication may be reproduced in any form whatsoever
without written prior approval by RADVision LTD..
RADVision LTD. reserves the right to revise this publication and make
changes without obligation to notify any person of such revisions or
changes.
************************************************************************
************************************************************************
$Revision:$
$Date:$
$Author: S. Cipolli$
************************************************************************
#endif
#ifndef RV_LOG_H
#define RV_LOG_H
#include "rvplatform.h"
#include "rvptrlist.h"
#include "rvmutex_.h"
#include "rvtime.h"
#if defined(__cplusplus)
extern "C" {
#endif
/* Public */
/* Level constants */
#define RV_LOGLEVEL_FATAL 0x00000001
#define RV_LOGLEVEL_ERROR 0x00000002
#define RV_LOGLEVEL_WARNING 0x00000004
#define RV_LOGLEVEL_SEND 0x00000008
#define RV_LOGLEVEL_RECEIVE 0x00000010
#define RV_LOGLEVEL_ENTER 0x00000020
#define RV_LOGLEVEL_LEAVE 0x00000040
#define RV_LOGLEVEL_INFO1 0x00000080
#define RV_LOGLEVEL_INFO2 0x00000100
#define RV_LOGLEVEL_INFO3 0x00000200
#define RV_LOGLEVEL_INFO4 0x00000400
/* Mask constants */
#define RV_LOGMASK_NONE 0
#define RV_LOGMASK_ALL (~0)
/* Types */
/*$
{type:
{name: RvLogLevel}
{superpackage: Kernel}
{include: rvlog.h}
{description:
{p: Describes an enumeration of log levels. Log levels distinguish different
types of log records.}
}
{enumeration:
{value: {n: RV_LOGLEVEL_FATAL} {d:Fatal errors}}
{value: {n: RV_LOGLEVEL_ERROR} {d:Non-fatal errors}}
{value: {n: RV_LOGLEVEL_WARNING} {d:Warnings}}
{value: {n: RV_LOGLEVEL_SEND} {d:Sent messages}}
{value: {n: RV_LOGLEVEL_RECEIVE} {d:Received messages}}
{value: {n: RV_LOGLEVEL_ENTER} {d:Function entry}}
{value: {n: RV_LOGLEVEL_LEAVE} {d:Function exit}}
{value: {n: RV_LOGLEVEL_INFO1} {d:General Information level 1}}
{value: {n: RV_LOGLEVEL_INFO2} {d:General Information level 2}}
{value: {n: RV_LOGLEVEL_INFO3} {d:General Information level 3}}
{value: {n: RV_LOGLEVEL_INFO4} {d:General Information level 4}}
}
{see_also:
{n: RvLogMask}
}
}
$*/
typedef unsigned int RvLogLevel;
/*$
{type:
{name: RvLogMask}
{superpackage: Kernel}
{include: rvlog.h}
{description:
{p: Describes an bit mask of log levels. Log levels distinguish different
types of log records. A log mask is created by bitwise ORing RvLogLevel
constants (See RvLogLevel for details). }
}
{see_also:
{n: RvLogLevel}
}
}
$*/
typedef RvLogLevel RvLogMask;
/*
* Configuration constant:
* RV_LOGMASK Determines the compile-time log level
* features available.
*/
#if !defined(RV_LOGMASK)
# if defined(RV_PERFORMANCETEST_ON)
# define RV_LOGMASK (RV_LOGMASK_NONE)
# else
# define RV_LOGMASK (RV_LOGMASK_ALL)
# endif
#endif
/*
* Configuration constant:
* RV_LOGMASKDEFAULT Determines the default run-time log level.
* By default the level is RV_LOGMASK
*/
#if !defined(RV_LOGMASKDEFAULT)
# define RV_LOGMASKDEFAULT (RV_LOGMASK)
#endif
/*$
{function:
{name: rvLogFatal }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log a fatal error.}
}
{proto: void rvLogFatal(RvLog* l, const char* text);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: text} {d: Associated text.}}
}
}
$*/
/* FATAL logging */
#if (RV_LOGMASK & RV_LOGLEVEL_FATAL)
# define rvLogFatal(l, txt) (rvLogText_(l, RV_LOGLEVEL_FATAL, (txt)))
#else
# define rvLogFatal(l, txt)
#endif
/*$
{function:
{name: rvLogError }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log an error.}
}
{proto: void rvLogError(RvLog* l, const char* text);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: text} {d: Associated text.}}
}
}
$*/
/* ERROR logging */
#if (RV_LOGMASK & RV_LOGLEVEL_ERROR)
# define rvLogError(l, txt) (rvLogText_(l, RV_LOGLEVEL_ERROR, (txt)))
#else
# define rvLogError(l, txt)
#endif
/*$
{function:
{name: rvLogWarning }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log a warning.}
}
{proto: void rvLogWarning(RvLog* l, const char* text);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: text} {d: Associated text.}}
}
}
$*/
/* WARNING logging */
#if (RV_LOGMASK & RV_LOGLEVEL_WARNING)
# define rvLogWarning(l, txt) (rvLogText_(l, RV_LOGLEVEL_WARNING, (txt)))
#else
# define rvLogWarning(l, txt)
#endif
/*$
{function:
{name: rvLogSend }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log a sent message.}
}
{proto: void rvLogSend(RvLog* l, const char* msg);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: msg} {d: The message sent.}}
}
}
$*/
/* SEND logging */
#if (RV_LOGMASK & RV_LOGLEVEL_SEND)
# define rvLogSend(l, msg) (rvLogText_(l, RV_LOGLEVEL_SEND, (msg)))
#else
# define rvLogSend(l, msg)
#endif
/*$
{function:
{name: rvLogReceive }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log a received message.}
}
{proto: void rvLogReceived(RvLog* l, const char* msg);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: msg} {d: The message received.}}
}
}
$*/
/* RECEIVE logging */
#if (RV_LOGMASK & RV_LOGLEVEL_RECEIVE)
# define rvLogReceive(l, msg) (rvLogText_(l, RV_LOGLEVEL_RECEIVE, (msg)))
#else
# define rvLogReceive(l, msg)
#endif
/*$
{function:
{name: rvLogEnter }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log entry into a function.}
}
{proto: void rvLogEnter(RvLog* l, const char* fn);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: fn} {d: The name of the function entered.}}
}
}
$*/
/* ENTER logging */
#if (RV_LOGMASK & RV_LOGLEVEL_ENTER)
# define rvLogEnter(l, fn) (rvLogText_(l, RV_LOGLEVEL_ENTER, (fn)))
#else
# define rvLogEnter(l, fn)
#endif
/*$
{function:
{name: rvLogLeave }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log exit from a function.}
}
{proto: void rvLogLeave(RvLog* l, const char* fn);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: fn} {d: The name of the function exited.}}
}
}
$*/
/* LEAVE logging */
#if (RV_LOGMASK & RV_LOGLEVEL_LEAVE)
# define rvLogLeave(l, fn) (rvLogText_(l, RV_LOGLEVEL_LEAVE, (fn)))
#else
# define rvLogLeave(l, fn)
#endif
/*$
{function:
{name: rvLogInfo1 }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log general information at level 1.}
}
{proto: void rvLogInfo1(RvLog* l, const char* text);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: text} {d: Associated text.}}
}
}
$*/
/*$
{function:
{name: rvLogInt1 }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log an integer name value pair as an informational level 1.}
}
{proto: void rvLogInt1(RvLog* l, const char* name, int value, int radix);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: name} {d: The variable's name. }}
{param: {n: value} {d: The variable's integrer value.}}
{param: {n: radix} {d: The base that the varialbe's value will be display in.}}
}
}
$*/
/*$
{function:
{name: rvLogStr1 }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log an string name value pair as an informational level 1.}
}
{proto: void rvLogStr1(RvLog* l, const char* name, const char* value);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: name} {d: The variable's name. }}
{param: {n: value} {d: The variable's string value.}}
}
}
$*/
/* INFO1 logging */
#if (RV_LOGMASK & RV_LOGLEVEL_INFO1)
# define rvLogInfo1(l ,txt) (rvLogText_(l, RV_LOGLEVEL_INFO1, (txt)))
# define rvLogInt1(l, n, v, r) (rvLogInt_(l, RV_LOGLEVEL_INFO1, (n), (v), (r)))
# define rvLogStr1(l, n, v) (rvLogStr_(l, RV_LOGLEVEL_INFO1, (n), (v)))
#else
# define rvLogInfo1(l, txt)
# define rvLogInt1(l, n, v, r)
# define rvLogStr1(l, n, v)
#endif
/*$
{function:
{name: rvLogInfo2 }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log general information at level 2.}
}
{proto: void rvLogInfo2(RvLog* l, const char* text);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: text} {d: Associated text.}}
}
}
$*/
/*$
{function:
{name: rvLogInt2 }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log an integer name value pair as an informational level 2.}
}
{proto: void rvLogInt2(RvLog* l, const char* name, int value, int radix);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: name} {d: The variable's name. }}
{param: {n: value} {d: The variable's integrer value.}}
{param: {n: radix} {d: The base that the varialbe's value will be display in.}}
}
}
$*/
/*$
{function:
{name: rvLogStr2 }
{class: RvLog}
{include: rvlog.h}
{description:
{p: Log an string name value pair as an informational level 2.}
}
{proto: void rvLogStr2(RvLog* l, const char* name, const char* value);}
{params:
{param: {n: l} {d: A pointer to the log.}}
{param: {n: name} {d: The variable's name. }}
{param: {n: value} {d: The variable's string value.}}
}
}
$*/
/* INFO2 logging */
#if (RV_LOGMASK & RV_LOGLEVEL_INFO2)
# define rvLogInfo2(l, txt) (rvLogText_(l, RV_LOGLEVEL_INFO2, (txt)))
# define rvLogInt2(l, n, v, r) (rvLogInt_(l, RV_LOGLEVEL_INFO2, (n), (v), (r)))
# define rvLogStr2(l, n, v) (rvLogStr_(l, RV_LOGLEVEL_INFO2, (n), (v)))
#else
# define rvLogInfo2(l, txt)
# define rvLogInt2(l, n, v, r)
# define rvLogStr2(l, n, v)
#endif
/*$
{function:
{name: rvLogInfo3 }
{class: RvLog}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -