glog是google出品的一個(gè)C++日志庫
CentOS下glog的使用簡介
安裝依賴的庫
yum install glog-devel.x86_64
yum install gflags-devel.x86_64
編寫代碼client.cpp
#include <iostream>
#include <glog/logging.h>
using namespace std;
static void InitLog(const char* cmd)
{
FLAGS_logbufsecs = 0;
google::InitGoogleLogging(cmd);
FLAGS_log_dir = "/root/log/";
}
int main(int argc, char** argv)
{
InitLog(argv[0]);
LOG(INFO)<<"Hello world glog";
cout<<"hello world"<<endl;
return 0;
}
編寫Makefile
client:client.cpp
g++ -g client.cpp -o client -lglog
寫的不錯(cuò)的一個(gè)總結(jié)
https://www.cnblogs.com/hiloves/p/6009707.html