Apache Log4cxx Version 1.1.0
Loading...
Searching...
No Matches
loggerrepository.h
Go to the documentation of this file.
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_LOG_REPOSITORY_H
19#define _LOG4CXX_SPI_LOG_REPOSITORY_H
20
21#include <log4cxx/appender.h>
23#include <log4cxx/level.h>
25#include <functional>
26
27namespace log4cxx
28{
29namespace spi
30{
31
42class LOG4CXX_EXPORT LoggerRepository : public virtual helpers::Object
43{
44 public:
46 virtual ~LoggerRepository() {}
47
52 virtual void addHierarchyEventListener(const HierarchyEventListenerPtr&
53 listener) = 0;
54
58 virtual void ensureIsConfigured(std::function<void()> configurator) = 0;
59
64 virtual bool isDisabled(int level) const = 0;
65
70 virtual void setThreshold(const LevelPtr& level) = 0;
71
76 virtual void setThreshold(const LogString& val) = 0;
77
78 virtual void emitNoAppenderWarning(const Logger* logger) = 0;
79
85 virtual LevelPtr getThreshold() const = 0;
86
87 virtual LoggerPtr getLogger(const LogString& name) = 0;
88
89 virtual LoggerPtr getLogger(const LogString& name,
90 const spi::LoggerFactoryPtr& factory) = 0;
91
92 virtual LoggerPtr getRootLogger() const = 0;
93
94 virtual LoggerPtr exists(const LogString& name) = 0;
95
96 virtual void shutdown() = 0;
97
98 virtual LoggerList getCurrentLoggers() const = 0;
99
100 virtual void fireAddAppenderEvent(const Logger* logger, const Appender* appender) {};
101
102 virtual void fireRemoveAppenderEvent(const Logger* logger, const Appender* appender) {};
103
104 virtual void resetConfiguration() = 0;
105
106 virtual bool isConfigured() = 0;
107 virtual void setConfigured(bool configured) = 0;
108
109}; // class LoggerRepository
110
111} // namespace spi
112} // namespace log4cxx
113
114#endif //_LOG4CXX_SPI_LOG_REPOSITORY_H
Implement this interface for your own strategies for outputting log statements.
Definition: appender.h:51
This is the central class in the log4cxx package.
Definition: logger.h:51
base class for java-like objects.
Definition: object.h:105
A LoggerRepository is used to create and retrieve Loggers.
Definition: loggerrepository.h:43
virtual LoggerPtr getRootLogger() const =0
virtual LoggerPtr getLogger(const LogString &name)=0
virtual LoggerList getCurrentLoggers() const =0
virtual void ensureIsConfigured(std::function< void()> configurator)=0
Call configurator if not yet configured.
virtual void setThreshold(const LogString &val)=0
Another form of setThreshold accepting a string parameter instead of a Level.
virtual void fireAddAppenderEvent(const Logger *logger, const Appender *appender)
Definition: loggerrepository.h:100
virtual void emitNoAppenderWarning(const Logger *logger)=0
virtual void setConfigured(bool configured)=0
virtual LoggerPtr exists(const LogString &name)=0
virtual void resetConfiguration()=0
virtual void fireRemoveAppenderEvent(const Logger *logger, const Appender *appender)
Definition: loggerrepository.h:102
virtual void addHierarchyEventListener(const HierarchyEventListenerPtr &listener)=0
Add a HierarchyEventListener event to the repository.
virtual void setThreshold(const LevelPtr &level)=0
Set the repository-wide threshold.
virtual bool isDisabled(int level) const =0
Is the repository disabled for a given level? The answer depends on the repository threshold and the ...
virtual LoggerPtr getLogger(const LogString &name, const spi::LoggerFactoryPtr &factory)=0
virtual LevelPtr getThreshold() const =0
Get the repository-wide threshold.
std::shared_ptr< LoggerFactory > LoggerFactoryPtr
Definition: logmanager.h:34
Definition: configuration.h:25
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Level > LevelPtr
Definition: optionconverter.h:28
std::shared_ptr< Logger > LoggerPtr
Definition: defaultloggerfactory.h:27
std::vector< LoggerPtr > LoggerList
Definition: logmanager.h:29
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition: object.h:38