Apache log4cxx  Version 0.12.0
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 #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>
29 
30 namespace log4cxx
31 {
32 class Logger;
33 typedef std::shared_ptr<Logger> LoggerPtr;
34 typedef std::vector<LoggerPtr> LoggerList;
35 
36 namespace spi
37 {
39 typedef std::shared_ptr<LoggerFactory> LoggerFactoryPtr;
40 }
41 
49 class LOG4CXX_EXPORT LogManager
50 {
51  private:
52  static void* guard;
53  static spi::RepositorySelectorPtr repositorySelector;
54  static spi::RepositorySelectorPtr getRepositorySelector();
55 
56  public:
73  static void setRepositorySelector(spi::RepositorySelectorPtr selector,
74  void* guard);
75 
76  static spi::LoggerRepositoryPtr getLoggerRepository();
77 
81  static LoggerPtr getRootLogger();
82 
88  static LoggerPtr getLogger(const std::string& name);
95  static LoggerPtr getLogger(const std::string& name,
96  const spi::LoggerFactoryPtr& factory);
102  static LoggerPtr exists(const std::string& name);
103 #if LOG4CXX_WCHAR_T_API
104 
109  static LoggerPtr getLogger(const std::wstring& name);
116  static LoggerPtr getLogger(const std::wstring& name,
117  const spi::LoggerFactoryPtr& factory);
123  static LoggerPtr exists(const std::wstring& name);
124 #endif
125 #if LOG4CXX_UNICHAR_API
126 
131  static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
138  static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
139  const spi::LoggerFactoryPtr& factory);
145  static LoggerPtr exists(const std::basic_string<UniChar>& name);
146 #endif
147 #if LOG4CXX_CFSTRING_API
148 
153  static LoggerPtr getLogger(const CFStringRef& name);
160  static LoggerPtr getLogger(const CFStringRef& name,
161  const spi::LoggerFactoryPtr& factory);
167  static LoggerPtr exists(const CFStringRef& name);
168 #endif
169 
170 
176  static LoggerPtr getLoggerLS(const LogString& name);
183  static LoggerPtr getLoggerLS(const LogString& name,
184  const spi::LoggerFactoryPtr& factory);
185 
191  static LoggerPtr existsLS(const LogString& name);
192 
193  static LoggerList getCurrentLoggers();
194 
199  static void shutdown();
200 
205  static void resetConfiguration();
206 }; // class LogManager
207 } // namespace log4cxx
208 
209 #if defined(_MSC_VER)
210  #pragma warning ( pop )
211 #endif
212 
213 
214 #endif //_LOG4CXX_LOG_MANAGER_H
Use the LogManager class to retreive Logger instances or to operate on the current LoggerRepository...
Definition: logmanager.h:49
std::shared_ptr< LoggerFactory > LoggerFactoryPtr
Definition: logmanager.h:38
std::vector< LoggerPtr > LoggerList
Definition: logmanager.h:34
const struct __CFString * CFStringRef
Definition: logstring.h:36
Implement this interface to create new instances of Logger or a sub-class of Logger.
Definition: loggerfactory.h:32
std::shared_ptr< LoggerRepository > LoggerRepositoryPtr
Definition: defaultconfigurator.h:27
std::shared_ptr< Logger > LoggerPtr
Definition: defaultloggerfactory.h:26
Definition: appender.h:32
std::basic_string< logchar > LogString
Definition: logstring.h:66