Example #1
0
void ls_write_log( ChannelLog *cl, const char *fmt, ... )
{
	static char log_buf[BUFSIZE];
	va_list ap;
	
	/* format the string to write */
	va_start( ap, fmt );
	ircvsnprintf( log_buf, BUFSIZE, fmt, ap );
	va_end( ap );
	                                
	/* if the FD isn't opened yet, lets open a log file */
	if( cl->logfile == NULL  ) {
		if( ls_open_log( cl ) != NS_SUCCESS ) {
			return;
		}
	}
	/* ok, file is opened. write the string to it */
#ifdef DEBUG
	dlog( DEBUG1, "%s\n", log_buf );
#endif
	os_fprintf( cl->logfile, "%s", log_buf );
	cl->writecount++;
#ifdef DEBUG
	/* only flush the logfile in debug mode */
	os_fflush( cl->logfile );
#endif
	/* ok, now stat the file to check size */
	if( cl->writecount >= DOSIZE ) { 
		os_fflush( cl->logfile );
		ls_stat_file( cl );
	}
}
Example #2
0
/*!
*@brief        关闭存放诊断结果的文件
*@author       zhaohm3
*@retval
*@note
* 
*@since    2014-9-25 16:33
*@attention
* 
*/
GPublic void file_close_fresult()
{
    os_fflush(gpResultFile);
    os_fclose(gpResultFile);
    gpResultFile = NULL;
}
Example #3
0
/*!
*@brief        关闭存放运行时状态的文件
*@author       zhaohm3
*@retval
*@note
* 
*@since    2014-9-25 16:33
*@attention
* 
*/
GPublic void file_close_fstat()
{
    os_fflush(gpStatFile);
    os_fclose(gpStatFile);
    gpStatFile = NULL;
}
Example #4
0
/*!
*@brief        关闭存放调试信息的文件
*@author       zhaohm3
*@retval
*@note
* 
*@since    2014-9-25 16:30
*@attention
* 
*/
GPublic void file_close_fdebug()
{
    os_fflush(gpDebugFile);
    os_fclose(gpDebugFile);
    gpDebugFile = NULL;
}