log4cplus  2.1.0
hierarchylocker.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Module: Log4CPLUS
3 // File: hierarchylocker.h
4 // Created: 8/2003
5 // Author: Tad E. Smith
6 //
7 //
8 // Copyright 2003-2017 Tad E. Smith
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 
24 #ifndef LOG4CPLUS_HIERARCHY_LOCKER_HEADER_
25 #define LOG4CPLUS_HIERARCHY_LOCKER_HEADER_
26 
27 #include <log4cplus/config.hxx>
28 
29 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
30 #pragma once
31 #endif
32 
33 #include <log4cplus/tstring.h>
34 #include <log4cplus/appender.h>
35 #include <log4cplus/logger.h>
36 
37 
38 namespace log4cplus
39 {
40 
41  class Hierarchy;
42 
43 
48  public:
49  // ctor & dtor
52 
56  void resetConfiguration();
57 
61  Logger getInstance(const log4cplus::tstring& name);
62 
66  Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory);
67 
68  void addAppender(Logger &logger, log4cplus::SharedAppenderPtr& appender);
69 
70  private:
71  // Data
72  Hierarchy& h;
73  log4cplus::thread::MutexGuard hierarchyLocker;
74  LoggerList loggerList;
75  };
76 
77 } // end namespace log4cplus
78 
79 #endif // LOG4CPLUS_HIERARCHY_LOCKER_HEADER_
This is used to lock a Hierarchy.
HierarchyLocker(Hierarchy &h)
~HierarchyLocker() LOG4CPLUS_NOEXCEPT_FALSE
This class is specialized in retrieving loggers by name and also maintaining the logger hierarchy.
Definition: hierarchy.h:64
This is the central class in the log4cplus package.
Definition: logger.h:71
#define LOG4CPLUS_NOEXCEPT_FALSE
Definition: config.hxx:102
This header defines the Logger class and the logging macros.
SyncGuard< Mutex > MutexGuard
Definition: syncprims.h:79
std::basic_string< tchar > tstring
Definition: tstring.h:39
std::vector< Logger > LoggerList
This is a list of Loggers.
Definition: logger.h:61
#define LOG4CPLUS_EXPORT
Definition: win32.h:141