Apache Log4cxx Version 1.0.0
Loading...
Searching...
No Matches
logmanager.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_LOG_MANAGER_H
19#define _LOG4CXX_LOG_MANAGER_H
20
21#include <log4cxx/logstring.h>
22#include <vector>
24
25namespace log4cxx
26{
27class Logger;
28typedef std::shared_ptr<Logger> LoggerPtr;
29typedef std::vector<LoggerPtr> LoggerList;
30
31namespace spi
32{
33class LoggerFactory;
34typedef std::shared_ptr<LoggerFactory> LoggerFactoryPtr;
35}
36
44class LOG4CXX_EXPORT LogManager
45{
46 private:
47 static void* guard;
48 static spi::RepositorySelectorPtr getRepositorySelector();
49
50 public:
67 static void setRepositorySelector(spi::RepositorySelectorPtr selector,
68 void* guard);
69
71
79
88 static LoggerPtr getLogger(const std::string& name);
89
98 static LoggerPtr getLogger(const std::string& name,
99 const spi::LoggerFactoryPtr& factory);
103 static LoggerPtr exists(const std::string& name);
104#if LOG4CXX_WCHAR_T_API
113 static LoggerPtr getLogger(const std::wstring& name);
122 static LoggerPtr getLogger(const std::wstring& name,
123 const spi::LoggerFactoryPtr& factory);
127 static LoggerPtr exists(const std::wstring& name);
128#endif
129#if LOG4CXX_UNICHAR_API
139 static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
149 static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
150 const spi::LoggerFactoryPtr& factory);
154 static LoggerPtr exists(const std::basic_string<UniChar>& name);
155#endif
156#if LOG4CXX_CFSTRING_API
166 static LoggerPtr getLogger(const CFStringRef& name);
176 static LoggerPtr getLogger(const CFStringRef& name,
177 const spi::LoggerFactoryPtr& factory);
181 static LoggerPtr exists(const CFStringRef& name);
182#endif
183
184
194 static LoggerPtr getLoggerLS(const LogString& name);
204 static LoggerPtr getLoggerLS(const LogString& name,
205 const spi::LoggerFactoryPtr& factory);
206
210 static LoggerPtr existsLS(const LogString& name);
211
213
218 static void shutdown();
219
225 static void resetConfiguration();
226}; // class LogManager
227} // namespace log4cxx
228
229
230#endif //_LOG4CXX_LOG_MANAGER_H
Use the LogManager class to retreive Logger instances or to operate on the current LoggerRepository.
Definition: logmanager.h:45
static LoggerPtr getLogger(const std::wstring &name)
Retrieve the name Logger instance from the LoggerRepository using DefaultLoggerFactory to create it i...
static LoggerPtr exists(const std::wstring &name)
Does the logger name exist in the hierarchy?
static LoggerPtr getLogger(const CFStringRef &name)
Retrieve the name Logger instance from the LoggerRepository using DefaultLoggerFactory to create it i...
static LoggerPtr existsLS(const LogString &name)
Does the logger name exist in the hierarchy?
static LoggerPtr getLogger(const std::string &name, const spi::LoggerFactoryPtr &factory)
Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static void setRepositorySelector(spi::RepositorySelectorPtr selector, void *guard)
Use selector to source the LoggerRepository, but only if the correct guard is passed as parameter.
static spi::LoggerRepositoryPtr getLoggerRepository()
static LoggerPtr getLogger(const CFStringRef &name, const spi::LoggerFactoryPtr &factory)
Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static LoggerPtr getRootLogger()
Retrieve the root logger from the LoggerRepository.
static LoggerPtr getLogger(const std::basic_string< UniChar > &name, const spi::LoggerFactoryPtr &factory)
Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static LoggerPtr exists(const std::basic_string< UniChar > &name)
Does the logger name exist in the hierarchy?
static LoggerPtr getLogger(const std::wstring &name, const spi::LoggerFactoryPtr &factory)
Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static LoggerList getCurrentLoggers()
static LoggerPtr exists(const CFStringRef &name)
Does the logger name exist in the hierarchy?
static LoggerPtr getLoggerLS(const LogString &name, const spi::LoggerFactoryPtr &factory)
Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static void resetConfiguration()
Reset all values contained in this current LoggerRepository61 to their default.
static LoggerPtr getLogger(const std::string &name)
Retrieve the name Logger instance from the LoggerRepository using DefaultLoggerFactory to create it i...
static void shutdown()
Safely close and remove all appenders in all loggers including the root logger.
static LoggerPtr getLoggerLS(const LogString &name)
Retrieve the name Logger instance from the LoggerRepository using DefaultLoggerFactory to create it i...
static LoggerPtr getLogger(const std::basic_string< UniChar > &name)
Retrieve the name Logger instance from the LoggerRepository using DefaultLoggerFactory to create it i...
static LoggerPtr exists(const std::string &name)
Does the logger name exist in the hierarchy?
const struct __CFString * CFStringRef
Definition: logstring.h:30
std::shared_ptr< LoggerRepository > LoggerRepositoryPtr
Definition: optionconverter.h:33
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< Logger > LoggerPtr
Definition: defaultloggerfactory.h:27
std::vector< LoggerPtr > LoggerList
Definition: logmanager.h:29