Apache Log4cxx  Version 2.0.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_NS
28{
29namespace spi
30{
31
42class LOG4CXX_EXPORT LoggerRepository : public virtual helpers::Object
43{
44 public:
49 virtual ~LoggerRepository();
50
54 virtual void addHierarchyEventListener(const HierarchyEventListenerPtr& listener) = 0;
55
60 virtual void removeHierarchyEventListener(const spi::HierarchyEventListenerPtr& listener) = 0;
61
68 virtual void ensureIsConfigured(std::function<void()> configurator) = 0;
69
75 virtual bool isDisabled(int level) const = 0;
76
82 virtual void setThreshold(const LevelPtr& newLevel) = 0;
83
90 virtual void setThreshold(const LogString& newLevel) = 0;
91
96 virtual void emitNoAppenderWarning(const Logger* logger) = 0;
97
103 virtual LevelPtr getThreshold() const = 0;
104
115 virtual LoggerPtr getLogger(const LogString& name,
116 const spi::LoggerFactoryPtr& factory = {}) = 0;
117
129 virtual bool removeLogger(const LogString& name, bool ifNotUsed = true) = 0;
130
134 virtual LoggerPtr getRootLogger() const = 0;
135
140 virtual LoggerPtr exists(const LogString& name) = 0;
141
146 virtual void shutdown() = 0;
147
154 virtual LoggerList getCurrentLoggers() const = 0;
155
159 virtual void fireAddAppenderEvent(const Logger* logger, const Appender* appender);
160
164 virtual void fireRemoveAppenderEvent(const Logger* logger, const Appender* appender);
165
179 virtual void resetConfiguration() = 0;
180
184 virtual bool isConfigured() = 0;
185
189 virtual void setConfigured(bool configured) = 0;
190
196 virtual void updateChildren(const Logger* parent) = 0;
197}; // class LoggerRepository
198
199} // namespace spi
200} // namespace log4cxx
201
202#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 log4cxx/logger.h:52
base class for java-like objects.
Definition object.h:101
A LoggerRepository is used to create and retrieve Loggers.
Definition loggerrepository.h:43
virtual void removeHierarchyEventListener(const spi::HierarchyEventListenerPtr &listener)=0
Remove listener from the repository.
virtual void setThreshold(const LevelPtr &newLevel)=0
Enable logging for logging requests with level newLevel or higher.
virtual LoggerPtr getRootLogger() const =0
The logger that cannot be retrieved by name.
virtual LoggerPtr getLogger(const LogString &name, const spi::LoggerFactoryPtr &factory={})=0
Retrieve the name Logger instance.
virtual void updateChildren(const Logger *parent)=0
Refresh the configuration of all loggers where parent is somewhere in their ancestor chain.
virtual bool removeLogger(const LogString &name, bool ifNotUsed=true)=0
Remove the name Logger from the repository.
virtual LoggerList getCurrentLoggers() const =0
All the loggers currently defined in this repository.
virtual void ensureIsConfigured(std::function< void()> configurator)=0
Call configurator if not yet configured and configurator has not already been tried.
virtual void fireAddAppenderEvent(const Logger *logger, const Appender *appender)
Call addAppenderEvent on all registered listeners.
virtual void shutdown()=0
Close and remove all appenders in all categories including the root logger.
virtual void emitNoAppenderWarning(const Logger *logger)=0
Add a warning to internal debug output that logger does not have any Appender attached.
virtual void setConfigured(bool configured)=0
Set the configured status to true.
virtual LoggerPtr exists(const LogString &name)=0
Does name exist in the repository?
virtual bool isConfigured()=0
The value of the configured status.
virtual void resetConfiguration()=0
Reset all values contained in this repository instance to their default.
virtual void fireRemoveAppenderEvent(const Logger *logger, const Appender *appender)
Call removeAppenderEvent on all registered listeners.
virtual void addHierarchyEventListener(const HierarchyEventListenerPtr &listener)=0
Add listener to the repository.
virtual bool isDisabled(int level) const =0
Is the repository disabled for level?
virtual LevelPtr getThreshold() const =0
The current repository-wide threshold.
Definition appender.h:30
std::basic_string< logchar > LogString
Definition logstring.h:51
std::shared_ptr< Level > LevelPtr
Definition optionconverter.h:28
std::shared_ptr< Logger > LoggerPtr
Definition provisionnode.h:28
#define LOG4CXX_CAST_ENTRY(Interface)
Definition object.h:153
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition object.h:37
#define END_LOG4CXX_CAST_MAP()
Definition object.h:147
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:141