source: pacpusframework/branches/2.0-beta1/3rd/apache-log4cxx/include/log4cxx/logmanager.h@ 143

Last change on this file since 143 was 89, checked in by morasjul, 12 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 6.9 KB
Line 
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
30namespace log4cxx
31{
32 class Logger;
33 typedef helpers::ObjectPtrT<Logger> LoggerPtr;
34 typedef std::vector<LoggerPtr> LoggerList;
35
36 namespace spi {
37 class LoggerFactory;
38 typedef helpers::ObjectPtrT<LoggerFactory> LoggerFactoryPtr;
39 }
40
41 /**
42 * Use the <code>LogManager</code> class to retreive Logger
43 * instances or to operate on the current
44 * {@link log4cxx::spi::LoggerRepository LoggerRepository}.
45 * When the <code>LogManager</code> class is loaded
46 * into memory the default initialization procedure is inititated.
47 */
48 class LOG4CXX_EXPORT LogManager
49 {
50 private:
51 static void * guard;
52 static spi::RepositorySelectorPtr& getRepositorySelector();
53
54 public:
55 /**
56 Sets <code>LoggerFactory</code> but only if the correct
57 <em>guard</em> is passed as parameter.
58
59 <p>Initally the guard is null. If the guard is
60 <code>null</code>, then invoking this method sets the logger
61 factory and the guard. Following invocations will throw a {@link
62 helpers::IllegalArgumentException IllegalArgumentException},
63 unless the previously set <code>guard</code> is passed as the second
64 parameter.
65
66 <p>This allows a high-level component to set the {@link
67 spi::RepositorySelector RepositorySelector} used by the
68 <code>LogManager</code>.
69 */
70
71 static void setRepositorySelector(spi::RepositorySelectorPtr selector,
72 void * guard);
73
74 static spi::LoggerRepositoryPtr& getLoggerRepository();
75
76 /**
77 Retrieve the appropriate root logger.
78 */
79 static LoggerPtr getRootLogger();
80
81 /**
82 Retrieve the appropriate Logger instance.
83 * @param name logger name in current encoding.
84 * @return logger.
85 */
86 static LoggerPtr getLogger(const std::string& name);
87 /**
88 Retrieve the appropriate Logger instance.
89 * @param name logger name in current encoding.
90 * @param factory logger factory.
91 * @return logger.
92 */
93 static LoggerPtr getLogger(const std::string& name,
94 const spi::LoggerFactoryPtr& factory);
95 /**
96 * Determines if logger name exists in the hierarchy.
97 * @param name logger name.
98 * @return true if logger exists.
99 */
100 static LoggerPtr exists(const std::string& name);
101#if LOG4CXX_WCHAR_T_API
102 /**
103 Retrieve the appropriate Logger instance.
104 * @param name logger name.
105 * @return logger.
106 */
107 static LoggerPtr getLogger(const std::wstring& name);
108 /**
109 Retrieve the appropriate Logger instance.
110 * @param name logger name.
111 * @param factory logger factory.
112 * @return logger.
113 */
114 static LoggerPtr getLogger(const std::wstring& name,
115 const spi::LoggerFactoryPtr& factory);
116 /**
117 * Determines if logger name exists in the hierarchy.
118 * @param name logger name.
119 * @return true if logger exists.
120 */
121 static LoggerPtr exists(const std::wstring& name);
122#endif
123#if LOG4CXX_UNICHAR_API
124 /**
125 Retrieve the appropriate Logger instance.
126 * @param name logger name.
127 * @return logger.
128 */
129 static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
130 /**
131 Retrieve the appropriate Logger instance.
132 * @param name logger name.
133 * @param factory logger factory.
134 * @return logger.
135 */
136 static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
137 const spi::LoggerFactoryPtr& factory);
138 /**
139 * Determines if logger name exists in the hierarchy.
140 * @param name logger name.
141 * @return true if logger exists.
142 */
143 static LoggerPtr exists(const std::basic_string<UniChar>& name);
144#endif
145#if LOG4CXX_CFSTRING_API
146 /**
147 Retrieve the appropriate Logger instance.
148 * @param name logger name.
149 * @return logger.
150 */
151 static LoggerPtr getLogger(const CFStringRef& name);
152 /**
153 Retrieve the appropriate Logger instance.
154 * @param name logger name.
155 * @param factory logger factory.
156 * @return logger.
157 */
158 static LoggerPtr getLogger(const CFStringRef& name,
159 const spi::LoggerFactoryPtr& factory);
160 /**
161 * Determines if logger name exists in the hierarchy.
162 * @param name logger name.
163 * @return true if logger exists.
164 */
165 static LoggerPtr exists(const CFStringRef& name);
166#endif
167
168
169 /**
170 Retrieve the appropriate Logger instance.
171 * @param name logger name.
172 * @return logger.
173 */
174 static LoggerPtr getLoggerLS(const LogString& name);
175 /**
176 Retrieve the appropriate Logger instance.
177 * @param name logger name.
178 * @param factory logger factory.
179 * @return logger.
180 */
181 static LoggerPtr getLoggerLS(const LogString& name,
182 const spi::LoggerFactoryPtr& factory);
183
184 /**
185 * Determines if logger name exists in the hierarchy.
186 * @param name logger name.
187 * @return true if logger exists.
188 */
189 static LoggerPtr existsLS(const LogString& name);
190
191 static LoggerList getCurrentLoggers();
192
193 /**
194 Safely close and remove all appenders in all loggers including
195 the root logger.
196 */
197 static void shutdown();
198
199 /**
200 Reset all values contained in this current {@link
201 spi::LoggerRepository LoggerRepository} to their default.
202 */
203 static void resetConfiguration();
204 }; // class LogManager
205} // namespace log4cxx
206
207#if defined(_MSC_VER)
208#pragma warning ( pop )
209#endif
210
211
212#endif //_LOG4CXX_LOG_MANAGER_H
Note: See TracBrowser for help on using the repository browser.