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

📄 debugtrace.cpp

📁 mysee网络直播源代码Mysee Lite是Mysee独立研发的网络视频流媒体播放系统。在应有了P2P技术和一系列先进流媒体技术之后
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*
 *  Openmysee
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
// $_FILEHEADER_BEGIN ****************************

// 文件名称: DebugTrace.cpp
// 创建日期: 2005-04-04
// 创 建 人: 谢洲为
// 文件说明: 日志调试,输出各种调试数据
// $_FILEHEADER_END ******************************

#include "stdafx.h"
#include "DebugTrace.h"

#ifdef WIN32
#include <windows.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <stdarg.h>
#include <string.h>


int CDebugTrace::mnLogLevel = 3;	
char CDebugTrace::mszLogFileName[512] = {0};
unsigned CDebugTrace::muTraceOptions = Timestamp;
static CDebugTrace goDebugTrace;

// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace( )
// 函数参数: 
// 返 回 值: 
// 函数说明: 构造函数
// $_FUNCTION_END ********************************
CDebugTrace::CDebugTrace( )
{
    mlDataLen = 0;	
}


// $_FUNCTION_BEGIN ******************************
// 函数名称: ~CDebugTrace( )
// 函数参数: 
// 返 回 值: 
// 函数说明: 析构函数
// $_FUNCTION_END ********************************
CDebugTrace::~CDebugTrace( )
{
    
}


// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( char acCharVal )
// 函数参数: char acCharVal:要打印的字符
// 返 回 值: 
// 函数说明: 打印单个字符
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( char acCharVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    
    mlDataLen += sprintf( lpWritePtr,"%c",acCharVal );
    
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}



// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( bool abBoolVal )
// 函数参数: bool abBoolVal:要打印的BOOL型数据
// 返 回 值: 
// 函数说明: 打印bool值
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( bool abBoolVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    if ( abBoolVal )
    {
        mlDataLen += sprintf( lpWritePtr,"%s","true" );
    }
    else
    {
        mlDataLen += sprintf( lpWritePtr,"%s","false" );
    }
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}



// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( short asShortVal )
// 函数参数: short asShortVal:要打印的short型数据
// 返 回 值: 
// 函数说明: 打印short值
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( short asShortVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    
    mlDataLen += sprintf( lpWritePtr,"%d",asShortVal );
    
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}


// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( unsigned short asShortVal )
// 函数参数: unsigned short asShortVal:要打印的 unsigned short型数据
// 返 回 值: 
// 函数说明: 打印unsigned short值
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( unsigned short asShortVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    
    mlDataLen += sprintf( lpWritePtr,"%u",asShortVal );
    
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}

// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( int aiIntVal )
// 函数参数: int aiIntVal:要打印的 int 型数据
// 返 回 值: 
// 函数说明: 打印int值
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( int aiIntVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    
    mlDataLen += sprintf( lpWritePtr,"%d",aiIntVal );
    
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}


// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( unsigned int aiIntVal )
// 函数参数: unsigned int aiIntVal:要打印的 unsigned int 型数据
// 返 回 值: 
// 函数说明: 打印 unsigned int值
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( unsigned int aiIntVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    
    mlDataLen += sprintf( lpWritePtr,"%u",aiIntVal );
    
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}

// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( long aiIntVal )
// 函数参数: long aiIntVal:要打印的 long 型数据
// 返 回 值: 
// 函数说明: 打印 long值
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( long alLongVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    
    mlDataLen += sprintf( lpWritePtr,"%ld",alLongVal );
    
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}

// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( unsigned long aiIntVal )
// 函数参数: unsigned long aiIntVal:要打印的 unsigned long 型数据
// 返 回 值: 
// 函数说明: 打印 unsigned long
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( unsigned long alLongVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    
    mlDataLen += sprintf( lpWritePtr,"%lu",alLongVal );
    
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}

// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( float afFloatVal )
// 函数参数: float afFloatVal:要打印的 float 型数据
// 返 回 值: 
// 函数说明: 打印float值
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( float afFloatVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    
    mlDataLen += sprintf( lpWritePtr,"%f",afFloatVal );
    
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}

// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( double afdoubleVal )
// 函数参数: double afdoubleVal:要打印的 double 型数据
// 返 回 值: 
// 函数说明: 打印double值
// $_FUNCTION_END ********************************
CDebugTrace& CDebugTrace::operator << ( double afdoubleVal )
{
    char * lpWritePtr = mszPrintBuff + mlDataLen;
    
    mlDataLen += sprintf( lpWritePtr,"%f",afdoubleVal );
    
    ASSERT( mlDataLen <= DEF_TRACE_BUFF_LEN );
    return *this;
}


// $_FUNCTION_BEGIN ******************************
// 函数名称: CDebugTrace& operator << ( __int64 aiInt64Val )
// 函数参数: __int64 aiInt64Val:要打印的 __int64  型数据
// 返 回 值: 
// 函数说明: 打印64位整数

⌨️ 快捷键说明

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