上一篇中,我讲了关于如何生成库的方法,那么这一节我们一起看看如何使用它
安排代码:
#include<iostream>
#include<string>
#include "glog/logging.h"
using namespace std;
#ifdef _DEBUG
#pragma comment(lib,"glogd.lib")
#else
#pragma comment(lib,"glog.lib")
#endif
void main()
{
//1初始化--》记得释放
google::InitGoogleLogging("Project27");//括号内是程序名
string home = "./Tylog/"; //要先创建此目录,否则运行报错.
string info_log = home + "master_info_";
google::SetLogDestination(0, info_log.c_str());
/*string warning_log = home + "master_warning_";
google::SetLogDestination(1, warning_log.c_str());
string error_log = home + "master_error_";
google::SetLogDestination(2, error_log.c_str());
string fatal_log = home + "master_fatal_";
google::SetLogDestination(3, fatal_log.c_str());*/
// You can specify one of the following severity levels (in increasing order of severity)
LOG(INFO) <<

最低0.47元/天 解锁文章
2338

被折叠的 条评论
为什么被折叠?



