16 const char* stringFormat,
20 va_start(va, stringFormat);
21 category.
logva(priority, stringFormat, va);
32 if ((tmpAppender == appender) ||
33 (tmpAppender == appender2) ||
34 (tmpAppender == &appender3))
36 std::cout <<
"tmpAppender == appender or appender2 or appender3" << std::endl;
40 std::cout <<
"tmpAppender != appender or appender2 or appender3" << std::endl;
45 if (tmpAppender == appender2)
47 std::cout <<
"tmpAppender == appender2" << std::endl;
51 std::cout <<
"tmpAppender != appender2" << std::endl;
55 if (tmpAppender == &appender3)
57 std::cout <<
"tmpAppender == appender3" << std::endl;
61 std::cout <<
"tmpAppender != appender3" << std::endl;
96 std::cout <<
"You should see three lines of \"root error #1\"" << std::endl;
97 root.
error(
"root error #1");
98 std::cout <<
"Did you?" << std::endl;
101 std::cout <<
"You should see messages that tmpAppender == other appenders" << std::endl;
103 std::cout <<
"Did you?" << std::endl;
115 std::cout <<
"You should not see any lines of \"root error #2\"" << std::endl;
116 root.
error(
"root error #2");
117 std::cout <<
"Did you?" << std::endl;
120 std::cout <<
"You should see messages that tmpAppender != other appenders" << std::endl;
122 std::cout <<
"Did you?" << std::endl;
140 int main(
int argc,
char** argv) {
168 std::cout <<
" root priority = " << root.
getPriority() << std::endl;
169 std::cout <<
" sub1 priority = " << sub1.
getPriority() << std::endl;
170 std::cout <<
" sub2 priority = " << sub2.
getPriority() << std::endl;
172 root.
error(
"root error");
173 root.
warn(
"root warn");
174 sub1.
error(
"sub1 error");
175 sub1.
warn(
"sub1 warn");
176 sub2.
error(
"sub2 error");
177 sub2.
warn(
"sub2 warn");
189 std::cout <<
" root priority = " << root.
getPriority() << std::endl;
190 std::cout <<
" sub1 priority = " << sub1.
getPriority() << std::endl;
191 std::cout <<
" sub2 priority = " << sub2.
getPriority() << std::endl;
193 std::cout <<
"priority info" << std::endl;
194 root.
error(
"root error");
195 root.
warn(
"root warn");
196 sub1.
error(
"sub1 error");
197 sub1.
warn(
"sub1 warn");
198 sub2.
error(
"sub2 error");
199 sub2.
warn(
"sub2 warn");
200 sub2.
error(
"%s %s %d",
"test",
"vform", 123);
206 for (
int i = 0; i < 10; i++) {
208 sprintf(nm,
"subs%d", i);
216 std::vector<log4cpp::Category*>* allCats;
217 std::vector<log4cpp::Category*>::const_iterator iter;
220 for (iter = allCats->begin(); iter != allCats->end(); iter++) {
221 (*iter)->removeAllAppenders();
CategoryStream warnStream()
void warn(const char *stringFormat,...)
int main(int argc, char **argv)
LOG4CPP_EXPORT CategoryStream & eol(CategoryStream &os)
virtual Appender * getAppender() const
virtual void setAdditivity(bool additivity)
static Category & getInstance(const std::string &name)
void testMultiAppenders()
virtual void logva(Priority::Value priority, const char *stringFormat, va_list va)
virtual void removeAllAppenders()
static Category & getRoot()
virtual void removeAppender(Appender *appender)
virtual Priority::Value getPriority() const
virtual void setPriority(Priority::Value priority)
static std::vector< Category * > * getCurrentCategories()
virtual void setLayout(Layout *layout=NULL)
void testGetAppender(log4cpp::Category &category, log4cpp::Appender *appender, log4cpp::Appender *appender2, log4cpp::Appender &appender3)
virtual void addAppender(Appender *appender)
void error(const char *stringFormat,...)
void testLogva(log4cpp::Category &category, log4cpp::Priority::Value priority, const char *stringFormat,...)
virtual void setLayout(Layout *layout)=0