#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]", ""})
{
{LL_FATAL, "fatal"},
{LL_ERROR, "error"},
{LL_WARNING, "warning"},
{LL_INFO, "info"},
{LL_VERBOSE, "verbose"},
};
const auto &src = LOG_SRC[RAND_ARRAY_INDEX(LOG_SRC)];
LOG(src.ll,
"{} Hello {} {:010} {}", j, src.msg, ++i, k);
}
}
#define LOGGER_USE_LOCAL_TIME_
#define LOG(ll, fmtStr,...)