00001 #ifndef _LOG4CPP_WRAPPER_HH 00002 #define _LOG4CPP_WRAPPER_HH 00003 00004 #include <log4cpp/Category.hh> 00005 #include <log4cpp/NDC.hh> 00006 #include <log4cpp/PatternLayout.hh> 00007 #include <log4cpp/PropertyConfigurator.hh> 00008 #if defined (_WIN32) 00009 #include <log4cpp/Win32DebugAppender.hh> 00010 #endif 00011 00012 LOG4CPP_NS_BEGIN 00014 typedef struct { 00015 Category& (*getInstance)(const std::string& name); 00016 std::vector<Category*>* (*getCurrentCategories)(); 00017 Category* (*exists)(const std::string& name); 00018 Category& (*getRoot)(); 00019 void(*shutdown)(); 00020 void (Category::*logva)(Priority::Value priority, const char* stringFormat, va_list va); 00021 bool (Category::*isInfoEnabled)(); 00022 bool (Category::*isWarnEnabled)(); 00023 bool (Category::*isDebugEnabled)(); 00024 void (Category::*setPriority)(Priority::Value priority); 00025 void (Category::*addAppender)(Appender* appender); 00026 void (Category::*removeAppender)(Appender* appender); 00027 } category_t; 00028 00030 typedef struct { 00031 PatternLayout* (*create)(); 00032 void (PatternLayout::*setConversionPattern)(const std::string& conversionPattern); 00033 void(*destroy)(PatternLayout* object); 00034 } pattern_layout_t; 00035 00037 typedef struct { 00038 void(*configure)(std::istream& initStream); 00039 } property_configurator_t; 00040 00042 typedef struct { 00043 void(*push)(const std::string& message); 00044 std::string(*pop)(); 00045 } ndc_t; 00046 00047 #if defined (_WIN32) 00048 00049 typedef struct { 00050 Appender *(*create)(const std::string& name); 00051 } win32_debug_appender_t; 00052 #endif 00053 00055 typedef struct { 00056 Appender *(*createFileAppender)(const std::string& name, const std::string& fileName, bool append, mode_t mode); 00057 void (Appender::*setThreshold)(Priority::Value threshold); 00058 void (Appender::*setLayout)(Layout* layout); 00059 } appender_t; 00060 00062 typedef struct { 00063 category_t Category; 00064 pattern_layout_t PatternLayout; 00065 property_configurator_t PropertyConfigurator; 00066 ndc_t NDC; 00067 #if defined (_WIN32) 00068 win32_debug_appender_t Win32DebugAppender; 00069 #endif 00070 appender_t Appender; 00071 } wrapper_t; 00072 00074 extern "C" LOG4CPP_EXPORT const LOG4CPP_NS::wrapper_t Wrapper; 00075 LOG4CPP_NS_END 00076 00077 #endif // _LOG4CPP_WRAPPER_HH