本文整理汇总了C++中FilterPtr::addDestination方法的典型用法代码示例。如果您正苦于以下问题:C++ FilterPtr::addDestination方法的具体用法?C++ FilterPtr::addDestination怎么用?C++ FilterPtr::addDestination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilterPtr
的用法示例。
在下文中一共展示了FilterPtr::addDestination方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test16
// Test that sequence limiting works
void test16(const DestinationPtr &sink1) {
banner("test16 - sequence limiting");
FilterPtr limited = SequenceFilter::instance(10, 2, 5); // every other message beginning with #10, five total
limited->addDestination(sink1);
Stream merr = Stream("test16", INFO, limited);
for (size_t i=0; i<100; ++i) {
merr <<"i=" <<i <<"\n";
}
}
示例2: test15
// Test that rate limiting works
void test15(const DestinationPtr &sink1) {
banner("test15 - rate limiting");
FilterPtr limited = TimeFilter::instance(0.5);
limited->addDestination(sink1);
Stream merr = Stream("test15", INFO, limited);
for (size_t i=0; i<5000000; ++i) {
merr <<"i=" <<i <<"\n";
}
}
示例3: test15b
// Demonstrate rate limiting per importance level
void test15b(const DestinationPtr &sink1) {
banner("test15b - per importance rate limiting");
Facility log("test15b", sink1);
for (size_t i=DEBUG; i<=FATAL; ++i) {
Importance imp = (Importance)i;
FilterPtr limiter = TimeFilter::instance(1.0);
limiter->addDestination(log[imp].destination());
log[imp].destination(limiter);
}
for (size_t i=0; i<300000; ++i) {
log[DEBUG] <<"i=" <<i <<"\tdebugging message\n";
log[TRACE] <<"i=" <<i <<"\ttracing message\n";
log[WHERE] <<"i=" <<i <<"\tmajor execution point\n";
log[INFO] <<"i=" <<i <<"\tinformational message\n";
log[WARN] <<"i=" <<i <<"\twarning message\n";
log[ERROR] <<"i=" <<i <<"\terror message\n";
log[FATAL] <<"i=" <<i <<"\tfatal error message\n";
}
}