$search
00001 /* 00002 * AbortAppender.cpp 00003 * 00004 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 00005 * Copyright 2000, 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/AbortAppender.hh> 00012 #include <log4cpp/FactoryParams.hh> 00013 #include <cstdlib> 00014 #include <memory> 00015 00016 namespace log4cpp { 00017 00018 AbortAppender::AbortAppender(const std::string& name) : 00019 AppenderSkeleton(name) { 00020 } 00021 00022 AbortAppender::~AbortAppender() { 00023 close(); 00024 } 00025 00026 void AbortAppender::close() { 00027 // empty 00028 } 00029 00030 void AbortAppender::_append(const LoggingEvent& event) { 00031 std::abort(); 00032 } 00033 00034 bool AbortAppender::reopen() { 00035 return true; 00036 } 00037 00038 bool AbortAppender::requiresLayout() const { 00039 return false; 00040 } 00041 00042 void AbortAppender::setLayout(Layout* layout) { 00043 return; 00044 } 00045 00046 std::auto_ptr<Appender> create_abort_appender(const FactoryParams& params) 00047 { 00048 std::string name; 00049 params.get_for("abort appender").required("name", name); 00050 return std::auto_ptr<Appender>(new AbortAppender(name)); 00051 } 00052 }