#define LOGGER_USE_LOCAL_TIME_ false
#include <random>
namespace {
thread_local std::mt19937 g_rng{std::random_device{"/dev/urandom"}()};
#define RAND_ARRAY_INDEX(arr) std::uniform_int_distribution<size_t>{0,std::size(arr)-1}(g_rng)
struct FC_MatchStr
{
const std::string m_key;
FC_MatchStr(auto key): m_key(key) {}
bool operator()(std::string_view s) const { return s.contains(m_key); }
};
}
int main()
{
{
logger.configPath(2UL<<20, std::array{
"logs/all/{:%y%m%d}.log",
"logs/all/{:%y%m%d-%H}.log",
"logs/all/{:%y%m%d-%H-%M}.log"});
});
auto
nodes = bux::user::g_paraLog.partitionBy(std::initializer_list<FC_MatchStr>{"[foo]", "[bar]"});
nodes = bux::user::g_paraLog.partitionBy(std::initializer_list<FC_MatchStr>{"[eeny]", "[meeny]", "[miny]", "[moe]"});
{
logger.configPath(
"logs/{:%y-%m-%d}_no_eeny_meeny_miny_moe.log");
});
auto
subnodes = nodes[0].partitionBy(std::initializer_list<FC_MatchStr>{"[foo]", "[bar]"});
subnodes = nodes[1].partitionBy(std::initializer_list<FC_MatchStr>{"[foo]", "[bar]"});
subnodes = nodes[2].partitionBy(std::initializer_list<FC_MatchStr>{"[foo]", "[bar]"});
subnodes = nodes[3].partitionBy(std::initializer_list<FC_MatchStr>{"[foo]", "[bar]"});
subnodes = nodes[4].partitionBy(std::initializer_list<FC_MatchStr>{"[foo]", "[bar]"});
for (int i = 0; i < 200;)
for (auto j: {"[foo]", "[bar]", ""})
for (auto k: {"[eeny]", "[meeny]", "[miny]", "[moe]", ""})
{
};
const auto &src = LOG_SRC[RAND_ARRAY_INDEX(LOG_SRC)];
LOG(src.ll,
"{} Hello {} {:010} {}", j, src.msg, ++i, k);
}
}
@ LL_WARNING
Situation that should be warned but should not have sabotaged anything already.
@ LL_ERROR
Error not serious enough that the program can continue to run.
@ LL_INFO
Information worth mentioning about the current status, be it normal or abnormal.
@ LL_VERBOSE
More detailed or advanced information probably considered too much by some.
@ LL_FATAL
Error serious enough that the program should shut down immediately after reporting this.
#define LOGGER_USE_LOCAL_TIME_
#define LOG(ll, fmtStr,...)