//*****************************************************************************************
// Template No. SWF0012 Template Version No. 04.04.00
//
//*****************************************************************************************
// FUNCTION NAME : PrintLog()
//
//-------------------------------------------------- PURPOSE -----------------------------------------
//
// Print a text in log file
//---------------------------------------- $$ REQUIREMENTS $$ ----------------------------------------
//
// Format: $${TAG} R[#][Prod. ID]:Specification Path
//
// $$: ISGcq00622453
// TAG: [APP_GEN]
// R #: R[29]
// Prod.ID:
// Spec. Path: /vob/
//
//
//
//-------------------- PSEUDO CODE / DETAILED FUNCTION DESCRIPTION -------------------
//
// Creates a log file with the phone info
//
//------------------------------------------------ REVISIONS ------------------------------------------
// Date Name Tracking # Description
// --------- ------------------- ------------- ------------------------------
// 26ARP2011 Feng Liu ISGcq00622453 Initial Creation
//*****************************************************************************************************
//
//----------------------------------------- FUNCTION DEFINITION ---------------------------------------
void FeatureDisableDlg::PrintLog(CString& message)
{
if(APPLICATION_VERSION[0] != 'R')
{
try
{
//verify if it is already opened
if (m_logFile.m_hFile == CFile::hFileNull)
{
if(m_logFile.Open(LOG_FILE_NAME,
CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite))
{
m_logFile.SeekToEnd();
CString log;
log.Format("=====================================================/n",log);
time_t rawtime;
time ( &rawtime );
char timeStr[0x100];
if(!ctime_s(timeStr, 0x100, &rawtime)) {
log.Format("Execution date: %s", timeStr);
} else {
log.Format("Execution date: %s", "Can not read the time.");
}
m_logFile.Write(log, log.GetLength());
}
}
m_logFile.Write(message, message.GetLength());
}
catch (...)
{
}
}
}void FeatureDisableDlg::PrintLog(const char* message, ...)
{
// if(APPLICATION_VERSION[0] != 'R')
if(1)
{
va_list list;
va_start(list, message);
char szBuffer[MAX_OUTPUT_TEXT_SIZE];
_vsnprintf_s(szBuffer, sizeof(szBuffer), message, list);
CString log(szBuffer);
PrintLog(log);
va_end(list);
}
}
发表于 @ 2011年04月26日 10:13:00 | 评论( 0 ) | 编辑| 举报| 收藏
本文来自优快云博客,转载请标明出处:http://blog.youkuaiyun.com/asiainfolf/archive/2011/04/26/6363397.aspx