mfcレコードlog
622 ワード
void OutputLog(LPCTSTR logName, CString msg)
{
try
{
//
CStdioFile outFile(logName, CFile::modeNoTruncate | CFile::modeCreate | CFile::modeWrite | CFile::typeText);
CString msLine;
CTime tt = CTime::GetCurrentTime(); //
// Log , Log
msLine = tt.Format("[%Y-%m-%d, %H:%M:%S] ") + msg;
msLine += "
";
//
outFile.SeekToEnd();
outFile.WriteString(msLine);
outFile.Close();
}
catch (CFileException *fx)
{
fx->Delete();
}
}