Apache log4cxx Version 0.13.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#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
30namespace log4cxx
31{
32class Logger;
33typedef std::shared_ptr<Logger> LoggerPtr;
34typedef std::vector<LoggerPtr> LoggerList;
35
36namespace spi
37{
38class LoggerFactory;
39typedef std::shared_ptr<LoggerFactory> LoggerFactoryPtr;
40}
41
49class 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
77
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
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
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
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
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:50
static LoggerPtr getLogger(const std::wstring &name)
Retrieve the appropriate Logger instance.
static LoggerPtr exists(const std::wstring &name)
Determines if logger name exists in the hierarchy.
static LoggerPtr getLogger(const CFStringRef &name)
Retrieve the appropriate Logger instance.
static LoggerPtr existsLS(const LogString &name)
Determines if logger name exists in the hierarchy.
static LoggerPtr getLogger(const std::string &name, const spi::LoggerFactoryPtr &factory)
Retrieve the appropriate Logger instance.
static void setRepositorySelector(spi::RepositorySelectorPtr selector, void *guard)
Sets LoggerFactory 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 appropriate Logger instance.
static LoggerPtr getRootLogger()
Retrieve the appropriate root logger.
static LoggerPtr getLogger(const std::basic_string< UniChar > &name, const spi::LoggerFactoryPtr &factory)
Retrieve the appropriate Logger instance.
static LoggerPtr exists(const std::basic_string< UniChar > &name)
Determines if logger name exists in the hierarchy.
static LoggerPtr getLogger(const std::wstring &name, const spi::LoggerFactoryPtr &factory)
Retrieve the appropriate Logger instance.
static LoggerList getCurrentLoggers()
static LoggerPtr exists(const CFStringRef &name)
Determines if logger name exists in the hierarchy.
static LoggerPtr getLoggerLS(const LogString &name, const spi::LoggerFactoryPtr &factory)
Retrieve the appropriate Logger instance.
static void resetConfiguration()
Reset all values contained in this current LoggerRepository to their default.
static LoggerPtr getLogger(const std::string &name)
Retrieve the appropriate Logger instance.
static void shutdown()
Safely close and remove all appenders in all loggers including the root logger.
static LoggerPtr getLoggerLS(const LogString &name)
Retrieve the appropriate Logger instance.
static LoggerPtr getLogger(const std::basic_string< UniChar > &name)
Retrieve the appropriate Logger instance.
static LoggerPtr exists(const std::string &name)
Determines if logger name exists in the hierarchy.
const struct __CFString * CFStringRef
Definition: logstring.h:36
std::shared_ptr< LoggerFactory > LoggerFactoryPtr
Definition: logmanager.h:39
std::shared_ptr< LoggerRepository > LoggerRepositoryPtr
Definition: defaultconfigurator.h:28
Definition: messagehandler.h:23
std::basic_string< logchar > LogString
Definition: logstring.h:66
std::shared_ptr< Logger > LoggerPtr
Definition: defaultloggerfactory.h:27
std::vector< LoggerPtr > LoggerList
Definition: logmanager.h:34