Squashed 'libs/CommService/' content from commit 7ccc0fc
git-subtree-dir: libs/CommService git-subtree-split: 7ccc0fce88bbc5969df060058cf0fb57abe3bcf9
This commit is contained in:
26
libs/loguru/loguru_example/loguru_example.hpp
Normal file
26
libs/loguru/loguru_example/loguru_example.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "../loguru.hpp"
|
||||
|
||||
inline void sleep_ms(int ms)
|
||||
{
|
||||
VLOG_F(2, "Sleeping for %d ms", ms);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
|
||||
}
|
||||
|
||||
inline void complex_calculation()
|
||||
{
|
||||
LOG_SCOPE_F(INFO, "complex_calculation");
|
||||
LOG_F(INFO, "Starting time machine...");
|
||||
sleep_ms(200);
|
||||
LOG_F(WARNING, "The flux capacitor is not getting enough power!");
|
||||
sleep_ms(400);
|
||||
LOG_F(INFO, "Lighting strike!");
|
||||
VLOG_F(1, "Found 1.21 gigawatts...");
|
||||
sleep_ms(400);
|
||||
std::thread([](){
|
||||
loguru::set_thread_name("the past");
|
||||
LOG_F(ERROR, "We ended up in 1985!");
|
||||
}).join();
|
||||
}
|
||||
Reference in New Issue
Block a user