1 /*----------------------------------------------------------------------------
2 Name: I_LogFactory.h
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 -----------------------------------------------------------------------------*/
6
7 #ifndef _ORG_XMLBLASTER_UTIL_I_LOGFACTORY_H
8 #define _ORG_XMLBLASTER_UTIL_I_LOGFACTORY_H
9
10 #include <util/xmlBlasterDef.h>
11 #include <string>
12 #include <map>
13 #include <util/I_Log.h>
14
15 /**
16 * Interface for a factory of I_Log (logging) instances.
17 * <p />
18 * This allows to customize which logging library you want to use.
19 *
20 * @author <a href="mailto:xmlBlaster@marcelruff.info">Marcel Ruff</a>
21 */
22 namespace org { namespace xmlBlaster { namespace util {
23
24 class Dll_Export I_LogFactory {
25
26 public:
27 typedef std::map<std::string, std::string, std::less<std::string> > PropMap;
28
29 protected:
30 PropMap propMap_;
31
32 public:
33 //I_LogFactory() {}
34
35 virtual ~I_LogFactory() {}
36
37 /**
38 * Will be called on registration of your factory.
39 * @param properties A map containing key/values of properties (command line args etc),
40 * we keep a clone of it.
41 */
42 virtual void initialize(const PropMap& propMap) { propMap_ = propMap; };
43
44 /**
45 * Construct (if necessary) and return a Log instance, using the factory's current implementation.
46 * @param name Logical name of the Log instance to be returned
47 * (the meaning of this name is only known to the underlying logging implementation that is being wrapped)
48 */
49 virtual I_Log& getLog(const std::string& name="") = 0;
50
51 /**
52 * Free resources for the given logger.
53 * @param name
54 */
55 virtual void releaseLog(const std::string& name="") = 0;
56
57 }; // end of class I_LogFactory
58
59
60
61 }}} // end of namespace util
62
63 #endif // _ORG_XMLBLASTER_UTIL_I_LOGFACTORY_H
syntax highlighted by Code2HTML, v. 0.9.1