本文整理汇总了C++中LogSink::Refresh方法的典型用法代码示例。如果您正苦于以下问题:C++ LogSink::Refresh方法的具体用法?C++ LogSink::Refresh怎么用?C++ LogSink::Refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogSink
的用法示例。
在下文中一共展示了LogSink::Refresh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Refresh
VOID ServLog::Refresh()
{
LOG_SINK_TYPE OldActiveLogSinks = 0;
LOG_SINK_TYPE NewActiveLogSinks = Config::GetActiveLogSinks();
ULONG Index;
ServLog *Inst = ServLog::GetInstance();
//
// Save off the original active log sinks
//
OldActiveLogSinks = Inst->ActiveSinkTypes;
//
// Walk each individual type, checking to see whether or not it's been
// enabled.
//
for (Index = 0;
Index < (sizeof(LogSinkTypes) / sizeof(LOG_SINK_TYPE));
Index++)
{
//
// If this log sink type is enabled and was not previously enabled, we
// instantiate it and add it to the list of active sinks.
//
if ((NewActiveLogSinks & LogSinkTypes[Index]) &&
(!(OldActiveLogSinks & LogSinkTypes[Index])))
{
LogSink *Sink = LogSink::create(
LogSinkTypes[Index]);
Log(LOG_SEV_INFO, TEXT("Enabling log sink type %lu."),
LogSinkTypes[Index]);
//
// Add it to the list.
//
if (Sink)
Inst->SinkList.push_back(
Sink);
}
//
// Otherwise, if the original log sink had this sink type enabled, we may
// either need to remove it from the list of active sinks (if it's no
// longer in the new set), or we may need to refresh its settings.
//
else if (OldActiveLogSinks & LogSinkTypes[Index])
{
std::list<LogSink *>::iterator It;
for (It = Inst->SinkList.begin();
It != Inst->SinkList.end();
It++)
{
//
// Did we find the type we're looking for? If not, continue.
//
if ((*It)->GetType() != LogSinkTypes[Index])
continue;
LogSink *Sink = (*It);
//
// If this log sink type is no longer in the active set, then we
// must remove it from the list of active log sinks.
//
if (!(NewActiveLogSinks & LogSinkTypes[Index]))
{
Inst->SinkList.erase(It);
Log(LOG_SEV_INFO, TEXT("Disabling log sink type %lu."),
LogSinkTypes[Index]);
LogSink::destroy(
Sink);
break;
}
//
// Otherwise, if it's been enabled and is still enabled, refresh it to
// make sure everything is still good to go.
//
else
{
Log(LOG_SEV_INFO, TEXT("Refreshing log sink type %lu."),
LogSinkTypes[Index]);
Sink->Refresh();
}
}
}
}
//
// Update the active log sinks bitvector.
//
Inst->ActiveSinkTypes = NewActiveLogSinks;
}