随笔 - 6  文章 - 129  trackbacks - 0
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿(14)

随笔档案(6)

文章分类(467)

文章档案(423)

相册

收藏夹(18)

JAVA

搜索

  •  

积分与排名

  • 积分 - 815439
  • 排名 - 49

最新评论

阅读排行榜

评论排行榜

procedure TformMain.WriteLog(Err:boolean;sTrLog:string);
var sBackupFile,sDir:string;
    vFile: Textfile;
begin
  sDir:='指定目錄';
  if Copy(sDir, Length(sDir), 1) <> '\' then
    sDir := sDir + '\';
  //sDir:=ExtractFilePath(Application.ExeName)+'\';
  ForceDirectories(sDir + 'TESTLOG');
  sBackupFile := sDir + 'TESTLOG\'+FormatDateTime('YYYYMMDDHH',now())+'.log';
  AssignFile(vFile, sBackupFile);
  if FileExists(sBackupFile) then
    Append(vFile)
  else
    Rewrite(vFile);
  if not Err then
      WriteLn(vFile, FormatDateTime('yyyy/mm/dd hh:mm:ss', Now) +' [Error ]' +' - ' + sTrlog)
  else
      WriteLn(vFile, FormatDateTime('yyyy/mm/dd hh:mm:ss', Now) +' [      ]' +' - ' + sTrlog);
  CloseFile(vFile);
end;


posted on 2010-02-19 14:50 Ke 阅读(529) 评论(0)  编辑  收藏 所属分类: delphi

只有注册用户登录后才能发表评论。


网站导航: