寫日誌檔案

2022-04-06 10:32:41 字數 851 閱讀 2252

#region

《寫日誌檔案》

//////寫日誌檔案,儲存到指定的檔案

/// ///

日誌內容

///儲存到檔案

public

static

void writerlog(string log, string

filename)

catch

}//////

讀取模板檔案返回檔案內容

/// ///

///public

static

string readtemplatefile(string

filename)

catch

}///de

///如果日誌檔案大於1m則備份,並清空檔案

/// ///

private

static

void checklogfile(string

filepath)

info.copyto(path + @"

\" + datetime.now.ticks.tostring() + "

.txt");

info.delete();}}

catch

(exception ex)

}//////

寫日誌檔案,儲存到預設的檔案:bpfaq.log

/// ///

日誌內容

public

static

void writerlog(string

log)

#endregion

《結束日誌檔案》

linux寫日誌檔案

呼叫errorlog 函式可以向指定的logfile檔案中寫入自定義的結構體error message型別的資料 include include include include include include struct error message typedef struct error mes...

Qt中寫日誌檔案

linux系統下程式如下 include include include include include include void mymessageoutput qtmsgtype type,const char msg if text.isempty qtextstream ts file ts...

C語言寫檔案或日誌

功能 獲取當前系統時間 返回值 0 成功,1 失敗 out 儲存返回的系統時間,格式由fmt決定 fmt 0 返回 yyyy mm dd hh24 mi ss,1 返回 yyyy mm dd,2 返回 hh24 mi ss int gettime char out,int fmt 獲取當前系統時間 ...