File: FixedContextCategory.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 (100 lines) | stat: -rw-r--r-- 2,776 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
 * FixedContextCategory.cpp
 *
 * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
 * Copyright 2001, Bastiaan Bakker. All rights reserved.
 *
 * See the COPYING file for the terms of usage and distribution.
 */

#include "PortabilityImpl.hh"
#include <log4shib/FixedContextCategory.hh>

namespace log4shib {

    FixedContextCategory::FixedContextCategory(const std::string& name,
                                               const std::string& context) : 
        Category(name, Category::getInstance(name).getParent()),
        _delegate(Category::getInstance(name)),
        _context(context) {
    }

    FixedContextCategory::~FixedContextCategory() {
    }

    void FixedContextCategory::setContext(const std::string& context) {
        _context = context;
    }

    std::string FixedContextCategory::getContext() const {
        return _context;
    }

    Priority::Value FixedContextCategory::getPriority() const throw() {
        return Category::getPriority();
    }
   
    Priority::Value FixedContextCategory::getChainedPriority() const throw() {
        Priority::Value result = getPriority();

        if (result == Priority::NOTSET) {
            result = _delegate.getChainedPriority();
        }

        return result;
    }
    
    void FixedContextCategory::addAppender(Appender* appender) throw() {
        // XXX do nothing for now
    }
    
    void FixedContextCategory::addAppender(Appender& appender) {
        // XXX do nothing for now
    }
    
    Appender* FixedContextCategory::getAppender() const {
        return _delegate.getAppender();
    }
    
    Appender* FixedContextCategory::getAppender(const std::string& name)
    const {
        return _delegate.getAppender(name);
    }

    AppenderSet FixedContextCategory::getAllAppenders() const {
        return _delegate.getAllAppenders();
    }

    void FixedContextCategory::removeAllAppenders() {
        // XXX do nothing for now
    }

    bool FixedContextCategory::ownsAppender() const throw() {
        return false;
    }
    
    bool FixedContextCategory::ownsAppender(Appender* appender) const throw() {
        return false;
    }
    
    void FixedContextCategory::callAppenders(const LoggingEvent& event)
            throw() {
        _delegate.callAppenders(event);
    }

    void FixedContextCategory::setAdditivity(bool additivity) {
        // XXX do nothing for now
    }

    bool FixedContextCategory::getAdditivity() const throw() {
        return _delegate.getAdditivity();
    }

    void FixedContextCategory::_logUnconditionally2(Priority::Value priority,
            const std::string& message) throw() {
        LoggingEvent event(getName(), message, _context, priority);
        callAppenders(event);
    }
    
}