00001 /* 00002 * AppenderSkeleton.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/AppenderSkeleton.hh> 00012 00013 namespace log4cpp { 00014 00015 AppenderSkeleton::AppenderSkeleton(const std::string& name) : 00016 Appender(name), 00017 _threshold(Priority::NOTSET), 00018 _filter(NULL) { 00019 } 00020 00021 AppenderSkeleton::~AppenderSkeleton() { 00022 if (_filter) 00023 delete _filter; 00024 } 00025 00026 bool AppenderSkeleton::reopen() { 00027 return true; 00028 } 00029 00030 void AppenderSkeleton::doAppend(const LoggingEvent& event) { 00031 if ((Priority::NOTSET == _threshold) || (event.priority <= _threshold)) { 00032 if (!_filter || (_filter->decide(event) != Filter::DENY)) { 00033 _append(event); 00034 } 00035 } 00036 } 00037 00038 void AppenderSkeleton::setThreshold(Priority::Value priority) { 00039 _threshold = priority; 00040 } 00041 00042 Priority::Value AppenderSkeleton::getThreshold() { 00043 return _threshold; 00044 } 00045 00046 void AppenderSkeleton::setFilter(Filter* filter) { 00047 if (_filter != filter) { 00048 if (_filter) 00049 delete _filter; 00050 00051 _filter = filter; 00052 } 00053 } 00054 00055 Filter* AppenderSkeleton::getFilter() { 00056 return _filter; 00057 } 00058 00059 } 00060