首页 > 解决方案 > 如何使用 g3log 为每个函数或每个模块创建日志文件

问题描述

我需要使用 g3log 为每个函数或每个模块创建日志文件

但我不知道该怎么做......我阅读了包装并尝试去做,但我是一个非常新的程序员......

// main.cpp
#include<g2log.hpp>
#include<g2logworker.hpp>
#include <std2_make_unique.hpp>
 
#include "CustomSink.h"
 
int main(int argc, char**argv) {
   using namespace g2;
   auto defaultHandler = LogWorker::createWithDefaultLogger(argv[0], 
                                                 path_to_log_file);
 
   // logger is initialized
   g2::initializeLogging(defaultHandler.worker.get());
 
   ...
}

任何人都可以写一个关于它的样本吗?

谢谢你!

标签: c++logging

解决方案


推荐阅读