VC++開發常用功能一系列文章 (歡迎訂閱,持續更新...)
源代碼demo已上傳到百度網盤:永久生效 .尾部附鏈接
以前寫了一篇 VC++寫日誌文件封裝類源代碼
採用的靜態類的方法,是不支持多線程的,只是一個普通功能的調試版,當然在多線程也能用,只要你的日誌不是打印的特殊頻繁!
今天更新一版本支持多線程的日誌版本:
//代碼採用的是vs2017
#include"Cloghelp.h"
CLogHelp m_log;
//call
m_log.SetLogFlag("./test.log");
m_log.WriteLog("hellworld");
直接上代碼:
頭文件如下:
#pragma once
#include"lockx.h"
#include <string>
#include <fstream>
#include <iostream>
#include<queue>
using namespace std;
enum DebugLevel
{
DEBU