本文整理汇总了C++中LogRecord::set_process方法的典型用法代码示例。如果您正苦于以下问题:C++ LogRecord::set_process方法的具体用法?C++ LogRecord::set_process怎么用?C++ LogRecord::set_process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogRecord
的用法示例。
在下文中一共展示了LogRecord::set_process方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]){
if(argc != 2){
cout<< "Usage: " << argv[0] << " <conf>" << endl;
return -1;
}
string conf(argv[1]);
if(NULL == FileService::Instance(conf)){
cout << "FileService::Instance faild" << endl;
return -1;
}
FileService::Load();
//MemoryPool
Memorypool::Instance();
//Threadpool
Threadpool::Instance();
//ActiveQueue
ActiveQueue<Request> *activeq = new ActiveQueue<Request>();
if(NULL == activeq){
cout << "New ActiveQueue failed" << endl;
return -1;
}
//Logrecord
LogRecord log;
log.set_type(17);
log.set_server("manager");
log.set_process("linkd");
log.set_message("Hello world\n");
int len = log.ByteSize();
char *buf = new char[len];
*buf = 0;
log.SerializeToArray(buf, len);
Trace("TRACE SerializeToArray: buf=%p, len=%d", buf, len);
// Scheduler
Scheduler *sch = new Scheduler(activeq);
if(NULL == sch){
cout << "New Scheduler failed" << endl;
return -1;
}
//start
Threadpool::Instance().schedule(boost::bind(&Scheduler::Dispatch, sch));
int i = 0;
while( i < 10){
Request *req = Memorypool::Instance().construct(buf, len);
activeq->Enqueue(req);
sleep(1);
i++;
}
Threadpool::Instance().wait();
return -1;
}