Apache log4cxx  Version 0.11.0
logmanager.h
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>
28 #include <log4cxx/spi/repositoryselector.h>
29 
30 namespace log4cxx
31 {
32 class Logger;
33 typedef helpers::ObjectPtrT<Logger> LoggerPtr;
34 typedef std::vector<LoggerPtr> LoggerList;
35 
36 namespace spi
37 {
38 class LoggerFactory;
39 typedef helpers::ObjectPtrT<LoggerFactory> LoggerFactoryPtr;
40 }
41 
49 class LOG4CXX_EXPORT LogManager
50 {
51  private:
52  static void* guard;
53  static spi::RepositorySelectorPtr& getRepositorySelector();
54 
55  public:
72  static void setRepositorySelector(spi::RepositorySelectorPtr selector,
73  void* guard);
74 
75  static spi::LoggerRepositoryPtr& getLoggerRepository();
76 
80  static LoggerPtr getRootLogger();
81 
87  static LoggerPtr getLogger(const std::string& name);
94  static LoggerPtr getLogger(const std::string& name,
95  const spi::LoggerFactoryPtr& factory);
101  static LoggerPtr exists(const std::string& name);
102 #if LOG4CXX_WCHAR_T_API
103 
108  static LoggerPtr getLogger(const std::wstring& name);
115  static LoggerPtr getLogger(const std::wstring& name,
116  const spi::LoggerFactoryPtr& factory);
122  static LoggerPtr exists(const std::wstring& name);
123 #endif
124 #if LOG4CXX_UNICHAR_API
125 
130  static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
137  static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
138  const spi::LoggerFactoryPtr& factory);
144  static LoggerPtr exists(const std::basic_string<UniChar>& name);
145 #endif
146 #if LOG4CXX_CFSTRING_API
147 
152  static LoggerPtr getLogger(const CFStringRef& name);
159  static LoggerPtr getLogger(const CFStringRef& name,
160  const spi::LoggerFactoryPtr& factory);
166  static LoggerPtr exists(const CFStringRef& name);
167 #endif
168 
169 
175  static LoggerPtr getLoggerLS(const LogString& name);
182  static LoggerPtr getLoggerLS(const LogString& name,
183  const spi::LoggerFactoryPtr& factory);
184 
190  static LoggerPtr existsLS(const LogString& name);
191 
192  static LoggerList getCurrentLoggers();
193 
198  static void shutdown();
199 
204  static void resetConfiguration();
205 }; // class LogManager
206 } // namespace log4cxx
207 
208 #if defined(_MSC_VER)
209  #pragma warning ( pop )
210 #endif
211 
212 
213 #endif //_LOG4CXX_LOG_MANAGER_H
Use the LogManager class to retreive Logger instances or to operate on the current LoggerRepository...
Definition: logmanager.h:49
Definition: appender.h:33