[89] | 1 | /*
|
---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
| 3 | * contributor license agreements. See the NOTICE file distributed with
|
---|
| 4 | * this work for additional information regarding copyright ownership.
|
---|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
| 6 | * (the "License"); you may not use this file except in compliance with
|
---|
| 7 | * the License. You may obtain a copy of the License at
|
---|
| 8 | *
|
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | *
|
---|
| 11 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 14 | * See the License for the specific language governing permissions and
|
---|
| 15 | * limitations under the License.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | #ifndef _LOG4CXX_SPI_APPENDER_ATTACHABLE_H_
|
---|
| 19 | #define _LOG4CXX_SPI_APPENDER_ATTACHABLE_H_
|
---|
| 20 |
|
---|
| 21 | #if defined(_MSC_VER)
|
---|
| 22 | #pragma warning ( push )
|
---|
| 23 | #pragma warning ( disable: 4231 4251 4275 4786 )
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
| 26 | #include <log4cxx/logstring.h>
|
---|
| 27 | #include <vector>
|
---|
| 28 | #include <log4cxx/helpers/objectptr.h>
|
---|
| 29 | #include <log4cxx/helpers/object.h>
|
---|
| 30 | #include <log4cxx/appender.h>
|
---|
| 31 |
|
---|
| 32 | namespace log4cxx
|
---|
| 33 | {
|
---|
| 34 |
|
---|
| 35 | namespace spi
|
---|
| 36 | {
|
---|
| 37 |
|
---|
| 38 | /**
|
---|
| 39 | * This Interface is for attaching Appenders to objects.
|
---|
| 40 | */
|
---|
| 41 | class LOG4CXX_EXPORT AppenderAttachable : public virtual helpers::Object
|
---|
| 42 | {
|
---|
| 43 | public:
|
---|
| 44 | // Methods
|
---|
| 45 | DECLARE_ABSTRACT_LOG4CXX_OBJECT(AppenderAttachable)
|
---|
| 46 | /**
|
---|
| 47 | * Add an appender.
|
---|
| 48 | */
|
---|
| 49 | virtual void addAppender(const AppenderPtr& newAppender) = 0;
|
---|
| 50 |
|
---|
| 51 | /**
|
---|
| 52 | * Get all previously added appenders as an AppenderList.
|
---|
| 53 | */
|
---|
| 54 | virtual AppenderList getAllAppenders() const = 0;
|
---|
| 55 |
|
---|
| 56 | /**
|
---|
| 57 | * Get an appender by name.
|
---|
| 58 | */
|
---|
| 59 | virtual AppenderPtr getAppender(const LogString& name) const = 0;
|
---|
| 60 |
|
---|
| 61 | /**
|
---|
| 62 | Returns <code>true</code> if the specified appender is in list of
|
---|
| 63 | attached attached, <code>false</code> otherwise.
|
---|
| 64 | */
|
---|
| 65 | virtual bool isAttached(const AppenderPtr& appender) const = 0;
|
---|
| 66 |
|
---|
| 67 | /**
|
---|
| 68 | * Remove all previously added appenders.
|
---|
| 69 | */
|
---|
| 70 | virtual void removeAllAppenders() = 0;
|
---|
| 71 |
|
---|
| 72 | /**
|
---|
| 73 | * Remove the appender passed as parameter from the list of appenders.
|
---|
| 74 | */
|
---|
| 75 | virtual void removeAppender(const AppenderPtr& appender) = 0;
|
---|
| 76 |
|
---|
| 77 | /**
|
---|
| 78 | * Remove the appender with the name passed as parameter from the
|
---|
| 79 | * list of appenders.
|
---|
| 80 | */
|
---|
| 81 | virtual void removeAppender(const LogString& name) = 0;
|
---|
| 82 |
|
---|
| 83 | // Dtor
|
---|
| 84 | virtual ~AppenderAttachable(){}
|
---|
| 85 | };
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | LOG4CXX_PTR_DEF(AppenderAttachable);
|
---|
| 89 |
|
---|
| 90 | }
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | #if defined(_MSC_VER)
|
---|
| 94 | #pragma warning ( pop )
|
---|
| 95 | #endif
|
---|
| 96 |
|
---|
| 97 |
|
---|
| 98 | #endif //_LOG4CXX_SPI_APPENDER_ATTACHABLE_H_
|
---|