00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00035 #ifndef OW_LOG_APPENDER_IFC_HPP_INCLUDE_GUARD_
00036 #define OW_LOG_APPENDER_IFC_HPP_INCLUDE_GUARD_
00037 #include "OW_config.h"
00038 #include "OW_CommonFwd.hpp"
00039 #include "OW_IntrusiveCountableBase.hpp"
00040 #include "OW_SortedVectorSet.hpp"
00041 #include "OW_LogLevel.hpp"
00042 #include "OW_LogMessagePatternFormatter.hpp"
00043
00044
00045 namespace OW_NAMESPACE
00046 {
00047
00048 #ifdef OW_WIN32
00049 template class OW_COMMON_API Array<String>;
00050 template class OW_COMMON_API SortedVectorSet<String>;
00051 #endif
00052
00053 class OW_COMMON_API LogAppender : public IntrusiveCountableBase
00054 {
00055 public:
00056
00057 virtual ~LogAppender();
00058
00063 void logMessage(const LogMessage& message) const;
00064
00065 bool categoryIsEnabled(const String& category) const;
00066 bool componentAndCategoryAreEnabled(const String& component, const String& category) const;
00067
00068 ELogLevel getLogLevel() const;
00069
00070 typedef SortedVectorMap<String, String> ConfigMap;
00071
00095 static LogAppenderRef createLogAppender(
00096 const String& name,
00097 const StringArray& components,
00098 const StringArray& categories,
00099 const String& messageFormat,
00100 const String& type,
00101 const ConfigMap& configItems);
00102
00104 static const StringArray ALL_COMPONENTS;
00106 static const StringArray ALL_CATEGORIES;
00109 static const String STR_TTCC_MESSAGE_FORMAT;
00111 static const String TYPE_SYSLOG;
00113 static const String TYPE_STDERR;
00115 static const String TYPE_FILE;
00117 static const String TYPE_NULL;
00118
00119 protected:
00120
00121 LogAppender(const StringArray& components, const StringArray& categories, const String& pattern);
00122
00123 private:
00124 virtual void doProcessLogMessage(const String& formattedMessage, const LogMessage& message) const = 0;
00125
00126 private:
00127 SortedVectorSet<String> m_components;
00128 bool m_allComponents;
00129 SortedVectorSet<String> m_categories;
00130 bool m_allCategories;
00131
00132 LogMessagePatternFormatter m_formatter;
00133
00134 };
00135 OW_EXPORT_TEMPLATE(OW_COMMON_API, IntrusiveReference, LogAppender);
00136
00137 }
00138
00139 #endif
00140
00141