File: testNTEventLog.cpp

package info (click to toggle)
log4shib 1.0.9-3~bpo7%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports-sloppy
  • size: 4,244 kB
  • sloc: cpp: 4,767; sh: 4,210; ansic: 818; makefile: 268
file content (46 lines) | stat: -rw-r--r-- 1,109 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// testNTEventLog.cpp : Derived from testPattern.cpp.
//

#include "log4shib/Portability.hh"

#ifdef WIN32
#include <windows.h>
#endif
#ifdef LOG4SHIB_HAVE_UNISTD_H
#include <unistd.h>
#endif

#include <stdlib.h>

#include "log4shib/Category.hh"
#include "log4shib/Appender.hh"
#include "log4shib/NTEventLogAppender.hh"
#include "log4shib/Priority.hh"

int main(int argc, char* argv[])
{
    log4shib::Appender* appender = 
        new log4shib::NTEventLogAppender("default", "testNTEventLog");

    log4shib::Category& sub1 = 
        log4shib::Category::getInstance(std::string("sub1"));
    sub1.addAppender(appender);
    sub1.setPriority(log4shib::Priority::DEBUG);
    
    sub1.emerg("sub1 emerg");
    sub1.fatal("sub1 fatal");
    sub1.alert("sub1 alert");
    sub1.crit("sub1 crit");
    sub1.error("sub1 error");
    sub1.warn("sub1 warn");
    sub1.notice("sub1 notice");
    sub1.info("sub1 info");
    sub1.debug("sub1 debug");
    sub1.log(log4shib::Priority::NOTSET, "sub1 notset");
    sub1.log(log4shib::Priority::ERROR, "sub1 error");

    log4shib::Category::shutdown();

    return 0;
}