Esempio n. 1
0
int main() {
    Logger l;
    auto r = l.Open("stdout", Logger::kLevelDebug, 1);
    assert(r== true && "open failed");

    l.SetThreadName("main");


    l.Logv(Logger::kLevelTrace, "hello %s", "world");
    l.Logv(Logger::kLevelDebug, "hello %s", "world");

    std::thread t([&](){
            l.Logv(Logger::kLevelWarn, "hello %s", "world");
            l.SetThreadName("thread-1");
            l.Logv(Logger::kLevelWarn, "hello with name: %s", "world");
        });

    t.join();

    log_open("stdout", Logger::kLevelDebug, 1);
    log_info("hello %s", "world");
}
Esempio n. 2
0
 void set_thread_name(const std::string &name) { g_logger.SetThreadName(name); }