00001 /* 00002 * FixedContextCategory.cpp 00003 * 00004 * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 00005 * Copyright 2001, Bastiaan Bakker. All rights reserved. 00006 * 00007 * See the COPYING file for the terms of usage and distribution. 00008 */ 00009 00010 #include "PortabilityImpl.hh" 00011 #include <log4cpp/FixedContextCategory.hh> 00012 00013 namespace log4cpp { 00014 00015 FixedContextCategory::FixedContextCategory(const std::string& name, 00016 const std::string& context) : 00017 Category(name, Category::getInstance(name).getParent()), 00018 _delegate(Category::getInstance(name)), 00019 _context(context) { 00020 } 00021 00022 FixedContextCategory::~FixedContextCategory() { 00023 } 00024 00025 void FixedContextCategory::setContext(const std::string& context) { 00026 _context = context; 00027 } 00028 00029 std::string FixedContextCategory::getContext() const { 00030 return _context; 00031 } 00032 00033 Priority::Value FixedContextCategory::getPriority() const throw() { 00034 return Category::getPriority(); 00035 } 00036 00037 Priority::Value FixedContextCategory::getChainedPriority() const throw() { 00038 Priority::Value result = getPriority(); 00039 00040 if (result == Priority::NOTSET) { 00041 result = _delegate.getChainedPriority(); 00042 } 00043 00044 return result; 00045 } 00046 00047 void FixedContextCategory::addAppender(Appender* appender) throw() { 00048 // XXX do nothing for now 00049 } 00050 00051 void FixedContextCategory::addAppender(Appender& appender) { 00052 // XXX do nothing for now 00053 } 00054 00055 Appender* FixedContextCategory::getAppender() const { 00056 return _delegate.getAppender(); 00057 } 00058 00059 Appender* FixedContextCategory::getAppender(const std::string& name) 00060 const { 00061 return _delegate.getAppender(name); 00062 } 00063 00064 AppenderSet FixedContextCategory::getAllAppenders() const { 00065 return _delegate.getAllAppenders(); 00066 } 00067 00068 void FixedContextCategory::removeAllAppenders() { 00069 // XXX do nothing for now 00070 } 00071 00072 bool FixedContextCategory::ownsAppender() const throw() { 00073 return false; 00074 } 00075 00076 bool FixedContextCategory::ownsAppender(Appender* appender) const throw() { 00077 return false; 00078 } 00079 00080 void FixedContextCategory::callAppenders(const LoggingEvent& event) 00081 throw() { 00082 _delegate.callAppenders(event); 00083 } 00084 00085 void FixedContextCategory::setAdditivity(bool additivity) { 00086 // XXX do nothing for now 00087 } 00088 00089 bool FixedContextCategory::getAdditivity() const throw() { 00090 return _delegate.getAdditivity(); 00091 } 00092 00093 void FixedContextCategory::_logUnconditionally2(Priority::Value priority, 00094 const std::string& message) throw() { 00095 LoggingEvent event(getName(), message, _context, priority); 00096 callAppenders(event); 00097 } 00098 00099 } 00100