📄 rvfileloglistener.h
字号:
#if (0)
************************************************************************
Filename:
Description:
************************************************************************
Copyright (c) 2001 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_FILELOGLISTENER_H
#define RV_FILELOGLISTENER_H
#include <stddef.h>
#include <stdio.h>
#include "rvplatform.h"
#include "rvtypes.h"
#include "rvlog.h"
#ifdef __cplusplus
extern "C" {
#endif
#if (RV_LOGMASK != RV_LOGMASK_NONE)
/*$
{type:
{name: RvFileLogListener}
{superpackage: Misc}
{include: rvfileloglistener.h}
{description:
{p: File log Listener. Log's Log Records to a pair of files. The log
records are written to the first file until N records are written at which
point subsequent records are written to the second file. After N records
have been written to the second file, the process is repeated starting back at the
first file.}
{p: The purpose of the double buffering is to allow ongoing logging without fear of
exhausting the disk space.}
{p: The number of record entries to write to each file and a prefix string
for generating the names of the two file are specified during construction of a
File Log Listenr object. The generated file names will be <prefix>1.txt and <prefix>2.txt
where <prefix> is the prefix string specified in the constructor.}
}
{methods:
{method: RvFileLogListener* rvFileLogListenerConstruct(RvFileLogListener* l, RvLogMask m, const char* prefix, size_t entries);}
{method: void rvFileLogListenerDestruct(RvFileLogListener* l);}
{method: RvLogListener* rvFileLogListenerGetLogListener(RvFileLogListener* l);}
}
{examples:
{example:
{description:
{p: This is an example of how to log information to the files logfile1.txt and
logfile2.txt with 1024 log entries per file, all log levels are
sent to the file.}
}
{code:
#include "rvlog.h"
#include "rvfileloglistener.h"
RvFileLogListener fileLog;
\/* Construct the file listener *\/
rvFileLogListenerConstruct(&fileLog, RV_LOGMASK_ALL ,"logfile", 1024);
\/* Register the file listener with the log *\/
rvLogRegisterListener(&rvLog,rvFileLogListenerGetLogListener(&fileLog));
}
}
}
{see_also:
{n: RvLog}
{n: RvLogListener}
{n: RvLogRecord}
{n: RvLogMask}
{n: RvStdioLogListener}
{n: RvRemoteLogListener}
}
}
$*/
#if defined(RV_IO_ANSI)
typedef struct {
FILE* fp;
size_t count;
int toggle;
RvBool enabled;
char prefix[127];
size_t entries;
RvLogListener listener;
} RvFileLogListener;
#else
#error RvFileLogListener requires Standard I/O
#endif
RvFileLogListener* rvFileLogListenerConstruct(RvFileLogListener* l,
RvLogMask m, const char* prefix, size_t entries);
/*$
{function:
{name: rvFileLogListenerDestruct}
{class: RvFileLogListener}
{include: rvfileloglistener.h}
{description:
{p: Destructs a File Log Listener.}
}
{proto: void rvFileLogListenerDestruct(RvFileLogListener* l);}
{params:
{param: {n: l} {d: A pointer to the File Log Listener.}}
}
}
$*/
#define rvFileLogListenerDestruct(_l) rvLogListenerDestruct(&(_l)->listener)
/*$
{function:
{name: rvFileLogListenerGetLogListener}
{class: RvFileLogListener}
{include: rvfileloglistener.h}
{description:
{p: Gets the RvLogListener of the File Log Listener object.}
}
{proto: RvLogListener* rvFileLogListenerGetLogListener(RvFileLogListener* l);}
{params:
{param: {n: l} {d: A pointer to the File Log Listener.}}
}
{returns: The RvLogListener object that represents this RvFileLogListener object.}
{see_also:
{n: RvLogListener}
}
}
$*/
#define rvFileLogListenerGetLogListener(_l) (&(_l)->listener)
#else
/***********************************************************************
* RvFileLogListener no logging stub
************************************************************************/
typedef struct
{
RvUint8 dummy;
} RvFileLogListener;
#define rvFileLogListenerConstruct(l,m,prefix,entries) (l)
#define rvFileLogListenerDestruct(l)
#define rvFileLogListenerGetLogListener(t) (NULL)
#endif
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -