testNTEventLog.cpp
Go to the documentation of this file.
1 // testNTEventLog.cpp : Derived from testPattern.cpp.
2 //
3 
4 #include "log4cpp/Portability.hh"
5 
6 #ifdef WIN32
7 #include <windows.h>
8 #endif
9 #ifdef LOG4CPP_HAVE_UNISTD_H
10 #include <unistd.h>
11 #endif
12 
13 #include <stdlib.h>
14 
15 #include "log4cpp/Category.hh"
16 #include "log4cpp/Appender.hh"
18 #include "log4cpp/Priority.hh"
19 
20 int main(int argc, char* argv[])
21 {
22  log4cpp::Appender* appender =
23  new log4cpp::NTEventLogAppender("default", "testNTEventLog");
24 
25  log4cpp::Category& sub1 =
26  log4cpp::Category::getInstance(std::string("sub1"));
27  sub1.addAppender(appender);
29 
30  sub1.emerg("sub1 emerg");
31  sub1.fatal("sub1 fatal");
32  sub1.alert("sub1 alert");
33  sub1.crit("sub1 crit");
34  sub1.error("sub1 error");
35  sub1.warn("sub1 warn");
36  sub1.notice("sub1 notice");
37  sub1.info("sub1 info");
38  sub1.debug("sub1 debug");
39  sub1.log(log4cpp::Priority::NOTSET, "sub1 notset");
40  sub1.log(log4cpp::Priority::ERROR, "sub1 error");
41 
43 
44  return 0;
45 }
46 
void notice(const char *stringFormat,...)
Definition: Category.cpp:319
int main(int argc, char *argv[])
void debug(const char *stringFormat,...)
Definition: Category.cpp:291
void fatal(const char *stringFormat,...)
Definition: Category.cpp:403
void warn(const char *stringFormat,...)
Definition: Category.cpp:333
virtual void log(Priority::Value priority, const char *stringFormat,...)
Definition: Category.cpp:267
static Category & getInstance(const std::string &name)
Definition: Category.cpp:35
static void shutdown()
Definition: Category.cpp:48
void crit(const char *stringFormat,...)
Definition: Category.cpp:361
virtual void setPriority(Priority::Value priority)
Definition: Category.cpp:71
void alert(const char *stringFormat,...)
Definition: Category.cpp:375
void info(const char *stringFormat,...)
Definition: Category.cpp:305
virtual void addAppender(Appender *appender)
Definition: Category.cpp:94
void error(const char *stringFormat,...)
Definition: Category.cpp:347
void emerg(const char *stringFormat,...)
Definition: Category.cpp:389


log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sun Jun 23 2019 19:14:17