testNTEventLog.cpp
Go to the documentation of this file.
00001 // testNTEventLog.cpp : Derived from testPattern.cpp.
00002 //
00003 
00004 #include "log4cpp/Portability.hh"
00005 
00006 #ifdef WIN32
00007 #include <windows.h>
00008 #endif
00009 #ifdef LOG4CPP_HAVE_UNISTD_H
00010 #include <unistd.h>
00011 #endif
00012 
00013 #include <stdlib.h>
00014 
00015 #include "log4cpp/Category.hh"
00016 #include "log4cpp/Appender.hh"
00017 #include "log4cpp/NTEventLogAppender.hh"
00018 #include "log4cpp/Priority.hh"
00019 
00020 int main(int argc, char* argv[])
00021 {
00022     log4cpp::Appender* appender = 
00023         new log4cpp::NTEventLogAppender("default", "testNTEventLog");
00024 
00025     log4cpp::Category& sub1 = 
00026         log4cpp::Category::getInstance(std::string("sub1"));
00027     sub1.addAppender(appender);
00028     sub1.setPriority(log4cpp::Priority::DEBUG);
00029     
00030     sub1.emerg("sub1 emerg");
00031     sub1.fatal("sub1 fatal");
00032     sub1.alert("sub1 alert");
00033     sub1.crit("sub1 crit");
00034     sub1.error("sub1 error");
00035     sub1.warn("sub1 warn");
00036     sub1.notice("sub1 notice");
00037     sub1.info("sub1 info");
00038     sub1.debug("sub1 debug");
00039     sub1.log(log4cpp::Priority::NOTSET, "sub1 notset");
00040     sub1.log(log4cpp::Priority::ERROR, "sub1 error");
00041 
00042     log4cpp::Category::shutdown();
00043 
00044     return 0;
00045 }
00046 


log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sat Jun 8 2019 18:45:46