CLog.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //  (c) 2006 by Basler Vision Technologies
00003 //  Section:  Vision Components
00004 //  Project:  GenApi
00005 //    Author:  Fritz Dierks
00006 //  $Header$
00007 //
00008 //  License: This file is published under the license of the EMVA GenICam  Standard Group.
00009 //  A text file describing the legal terms is included in  your installation as 'GenICam_license.pdf'.
00010 //  If for some reason you are missing  this file please contact the EMVA or visit the website
00011 //  (http://www.genicam.org) for a full copy.
00012 //
00013 //  THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
00014 //  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00015 //  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00016 //  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD  GROUP
00017 //  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  SPECIAL,
00018 //  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT  LIMITED TO,
00019 //  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  DATA, OR PROFITS;
00020 //  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  THEORY OF LIABILITY,
00021 //  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)
00022 //  ARISING IN ANY WAY OUT OF THE USE  OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00023 //  POSSIBILITY OF SUCH DAMAGE.
00024 //-----------------------------------------------------------------------------
00031 #ifndef LOG_CLOG_H_
00032 #define LOG_CLOG_H_
00033 
00034 #ifdef _MSC_VER
00035 #   pragma warning (push, 3)
00036 #   pragma warning(disable:4706)  // assignment within conditional expression
00037 #endif
00038 
00039 #include <log4cpp/Portability.hh>
00040 #include <log4cpp/Priority.hh>
00041 
00042 namespace LOG4CPP_NS
00043 {
00044     class Category;
00045     class Appender;
00046 }
00047 
00048 #include <stdio.h>
00049 #include <Base/GCBase.h>
00050 #include <Log/LogDll.h>
00051 
00052 namespace GENICAM_NAMESPACE
00053 {
00054 
00059     class LOG_DECL CLog
00060     {
00061     public:
00062 
00064         static LOG4CPP_NS::Category& GetRootLogger( void );
00065 
00067         static LOG4CPP_NS::Category& GetLogger( const gcstring &LoggerName );
00068         static LOG4CPP_NS::Category& GetLogger( const char LoggerName[] );
00069 
00071         static bool Exists( const gcstring &LoggerName );
00072         static bool Exists( const char LoggerName[] );
00073 
00075         static void PushNDC( const gcstring &ContextName );
00076         static void PushNDC( const char ContextName[] );
00077 
00079         static void PopNDC( void );
00080 
00082         static void Initialize( void );
00083 
00085         static void ShutDown( void );
00086 
00088         static void ConfigureDefault();
00089 
00091         static bool ConfigureFromFile( const gcstring &FileName );
00092         static bool ConfigureFromFile( const char FileName[] );
00093 
00095         static bool ConfigureFromEnvironment( void );
00096 
00098         static bool ConfigureFromString( const gcstring &ConfigData );
00099         static bool ConfigureFromString( const char ConfigData[] );
00100 
00102         static void RemoveAllAppenders(void);
00103 
00105         static LOG4CPP_NS::Appender *CreateFileAppender( const gcstring &aName, const gcstring &aPath, bool aAppend = false, const gcstring &aPattern = "" );
00106 
00108         static void AddAppender( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Appender *aAppender );
00109 
00110         static void RemoveAppender( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Appender *aAppender );
00111 
00112 
00114         static void SetPriorityInfo( LOG4CPP_NS::Category *aCategory );
00115         static void SetPriorityError( LOG4CPP_NS::Category *aCategory );
00116 
00118         static bool IsInfoEnabled( LOG4CPP_NS::Category *aCategory );
00119         static bool IsWarnEnabled( LOG4CPP_NS::Category *aCategory );
00120         static bool IsDebugEnabled( LOG4CPP_NS::Category *aCategory );
00121 
00123         static void LogPush( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Priority::Value aPriority, const char *aStringFormat, ... );
00124         static void LogPop( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Priority::Value aPriority, const char *aStringFormat, ... );
00125         static void Log( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Priority::Value aPriority, const char *aStringFormat, ... );
00126         static void LogVA( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Priority::Value aPriority, const char *aStringFormat, va_list arg );
00127 
00128     private:
00130         static void MakeSureLoggerHasBeenFound( void );
00131 
00133         static int g_RefCount;
00134         
00136         static const void *g_pLog4cpp;
00137 
00139 #if defined (_WIN32)
00140         typedef  HMODULE lib_handle_t;
00141 #else
00142         typedef void * lib_handle_t;
00143 #endif
00144         
00146         static lib_handle_t g_pLibHandle;
00147 
00149         static lib_handle_t OpenLibrary( const gcstring Name );
00150 
00152         static void *FindSymbol( lib_handle_t Handle, const gcstring Name );
00153         
00155         static bool g_HasFoundLogger;
00156 
00157     };
00158 
00159 }
00160 
00161 // Logging macros (can be replaced by real functions for compilers not supporting it?)
00162 #define GCLOGINFO( cat, ... ) if(GENICAM_NAMESPACE::CLog::Exists("")) { GENICAM_NAMESPACE::CLog::Log( cat, LOG4CPP_NS::Priority::INFO, ##__VA_ARGS__ ); }
00163 #define GCLOGINFOPUSH( cat, ... ) if(GENICAM_NAMESPACE::CLog::Exists("")) { GENICAM_NAMESPACE::CLog::LogPush( cat, LOG4CPP_NS::Priority::INFO, ##__VA_ARGS__ ); }
00164 #define GCLOGINFOPOP( cat, ... ) if(GENICAM_NAMESPACE::CLog::Exists("")) { GENICAM_NAMESPACE::CLog::LogPop( cat, LOG4CPP_NS::Priority::INFO, ##__VA_ARGS__ ); }
00165 #define GCLOGWARN( cat, ... ) if(GENICAM_NAMESPACE::CLog::Exists("")) { GENICAM_NAMESPACE::CLog::Log( cat, LOG4CPP_NS::Priority::WARN, ##__VA_ARGS__ ); }
00166 #define GCLOGERROR( cat, ... ) if(GENICAM_NAMESPACE::CLog::Exists("")) { GENICAM_NAMESPACE::CLog::Log( cat, LOG4CPP_NS::Priority::ERROR, ##__VA_ARGS__ ); }
00167 #define GCLOGDEBUG( cat, ... ) if(GENICAM_NAMESPACE::CLog::Exists("")) { GENICAM_NAMESPACE::CLog::Log( cat, LOG4CPP_NS::Priority::DEBUG,  ##__VA_ARGS__ ); }
00168 
00169 #endif // LOG_CLOG_H_


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 18:42:46