-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPropertyConfiguratorImpl.hh
More file actions
96 lines (82 loc) · 3.46 KB
/
PropertyConfiguratorImpl.hh
File metadata and controls
96 lines (82 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* PropertyConiguratorImpl.hh
*
* Copyright 2002, Log4cpp Project. All rights reserved.
*
* See the COPYING file for the terms of usage and distribution.
*/
#ifndef _LOG4CPP_PROPERTYCONFIGURATORIMPL_HH
#define _LOG4CPP_PROPERTYCONFIGURATORIMPL_HH
#include "PortabilityImpl.hh"
#include <log4cpp/Configurator.hh>
#include <log4cpp/Appender.hh>
#include <log4cpp/Category.hh>
#include <string>
#include <iostream>
#include <map>
#include <vector>
#include "Properties.hh"
namespace log4cpp {
class PropertyConfiguratorImpl {
public:
typedef std::map<std::string, Appender*> AppenderMap;
PropertyConfiguratorImpl();
virtual ~PropertyConfiguratorImpl();
/**
*
* @param initFileName
* @exception ConfigureFailure if the method encountered a read or
* syntax error.
*/
virtual void doConfigure(const std::string& initFileName);
/**
*
* @param in
* @exception ConfigureFailure if the method encountered a read or
* syntax error.
*/
virtual void doConfigure(std::istream& in);
protected:
/**
configure the given category. This includes setting its Priority
and adding any Appenders.
@todo setting other properties like 'additivity'.
@param categoryname Name of the category to configure.
The name 'rootCategory' refers to the root Category.
* @exception ConfigureFailure if the method encountered a read or
* syntax error.
**/
void configureCategory(const std::string& categoryname);
/**
* Get a list of categories for which we should do the configuration. This simply
* extracts the categories from the map.
* @param categories Reference to a list which is to receive the list of categories.
*/
void getCategories(std::vector<std::string>& categories) const;
void instantiateAllAppenders();
/**
* Intantiate and configure the appender referred to by the given name. This method searches the
* map to find all configuration parameters for the appender, and adds the appender
* to the given category. This isn't very general in the sense that it will need to
* be modified for each type of appender and layout. A more general solution would
* be to define an "options" interface for each appender and layout, so that we can
* simply call this method with a list of options instead of needing to know what is
* or is not available. This would also require some generic way of instantiating an
* object for which we have no knowledge. An "AppenderFactory" could be used which
* maps the given type to an actual object class registered with the factory (?? is this
* possible?).
* @param name String containing the name of the type of appender to be instantiated.
*/
Appender* instantiateAppender(const std::string& name);
/**
* Method for instantiating and configuring the layouts associated with each
* appender.
* @param appender Appender to which we are setting this layout.
* @param name Name in the properties of this appender.
*/
void setLayout(Appender* appender, const std::string& name);
Properties _properties;
AppenderMap _allAppenders;
};
}
#endif // _LOG4CPP_PROPERTIES_HH