我正在使用Pantheios库进行日志记录。我有:
pantheios::log(pantheios::debug, "I'm debug");
pantheios::log(pantheios::informational, "Some info");以下哪项输出:
[MyApplication, Jun 14 15:45:26.549; Debug] : I'm debug
[MyApplication.1, Jun 14 15:45:26.549; Informational] : Some info但我想在display info和debug之间进行选择:
set_level(pantheios::informational) //what should this be ?
pantheios::log(pantheios::debug, "I'm debug");
pantheios::log(pantheios::informational, "Some info");以下哪项输出:
[MyApplication.1, Jun 14 15:45:26.549; Informational] : Some info发布于 2012-06-14 21:36:52
实际过滤日志级别的“正确”方法是自定义记录器前端并覆盖pantheios::pantheios_fe_isSevereityLogged(),如下所示:
namespace
{
static int s_log_level = pantheios::debug;
}
PANTHEIOS_CALL(int) pantheios_fe_isSeverityLogged(void *token,
int severity, int backEndId)
{
return severity <= s_log_level;
}有关更多信息,请参阅this和this example。
https://stackoverflow.com/questions/11034238
复制相似问题