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 #pragma warning (push, 3)
00035 #pragma warning(disable:4706)  // assignment within conditional expression
00036 
00037 #include <log4cpp/Portability.hh>
00038 #include <log4cpp/Priority.hh>
00039 
00040 namespace LOG4CPP_NS
00041 {
00042     class Category;
00043     class Appender;
00044 }
00045 
00046 #include <stdio.h>
00047 #include <Base/GCBase.h>
00048 #include <Log/LogDll.h>
00049 
00050 namespace GENICAM_NAMESPACE
00051 {
00052 
00057     class LOG_DECL CLog
00058     {
00059     public:
00060 
00062         static LOG4CPP_NS::Category& GetRootLogger( void );
00063 
00065         static LOG4CPP_NS::Category& GetLogger( const gcstring &LoggerName );
00066         static LOG4CPP_NS::Category& GetLogger( const char LoggerName[] );
00067 
00069         static bool Exists( const gcstring &LoggerName );
00070         static bool Exists( const char LoggerName[] );
00071 
00073         static void PushNDC( const gcstring &ContextName );
00074         static void PushNDC( const char ContextName[] );
00075 
00077         static void PopNDC( void );
00078 
00080         static void Initialize( void );
00081 
00083         static void ShutDown( void );
00084 
00086         static void ConfigureDefault();
00087 
00089         static bool ConfigureFromFile( const gcstring &FileName );
00090         static bool ConfigureFromFile( const char FileName[] );
00091 
00093         static bool ConfigureFromEnvironment( void );
00094 
00096         static bool ConfigureFromString( const gcstring &ConfigData );
00097         static bool ConfigureFromString( const char ConfigData[] );
00098 
00100         static void RemoveAllAppenders(void);
00101 
00103         static LOG4CPP_NS::Appender *CreateFileAppender( const gcstring &aName, const gcstring &aPath, bool aAppend = false, const gcstring &aPattern = "" );
00104 
00106         static void AddAppender( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Appender *aAppender );
00107 
00108         static void RemoveAppender( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Appender *aAppender );
00109 
00110 
00112         static void SetPriorityInfo( LOG4CPP_NS::Category *aCategory );
00113         static void SetPriorityError( LOG4CPP_NS::Category *aCategory );
00114 
00116         static bool IsInfoEnabled( LOG4CPP_NS::Category *aCategory );
00117         static bool IsWarnEnabled( LOG4CPP_NS::Category *aCategory );
00118         static bool IsDebugEnabled( LOG4CPP_NS::Category *aCategory );
00119 
00121         static void LogPush( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Priority::Value aPriority, const char *aStringFormat, ... );
00122         static void LogPop( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Priority::Value aPriority, const char *aStringFormat, ... );
00123         static void Log( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Priority::Value aPriority, const char *aStringFormat, ... );
00124         static void LogVA( LOG4CPP_NS::Category *aCategory, LOG4CPP_NS::Priority::Value aPriority, const char *aStringFormat, va_list arg );
00125 
00126     private:
00128         static void MakeSureLoggerHasBeenFound( void );
00129 
00131         static int g_RefCount;
00132         
00134         static const void *g_pLog4cpp;
00135 
00137 #if defined (_WIN32)
00138         typedef  HMODULE lib_handle_t;
00139 #else
00140         typedef void * lib_handle_t;
00141 #endif
00142         
00144         static lib_handle_t g_pLibHandle;
00145 
00147         static lib_handle_t OpenLibrary( const gcstring Name );
00148 
00150         static void *FindSymbol( lib_handle_t Handle, const gcstring Name );
00151         
00153         static bool g_HasFoundLogger;
00154 
00155     };
00156 
00157 }
00158 
00159 // Logging macros (can be replaced by real functions for compilers not supporting it?)
00160 #define GCLOGINFO( cat, ... ) if(cat != NULL) GENICAM_NAMESPACE::CLog::Log( cat, LOG4CPP_NS::Priority::INFO, ##__VA_ARGS__ )
00161 #define GCLOGINFOPUSH( cat, ... ) if(cat != NULL) GENICAM_NAMESPACE::CLog::LogPush( cat, LOG4CPP_NS::Priority::INFO, ##__VA_ARGS__ )
00162 #define GCLOGINFOPOP( cat, ... ) if(cat != NULL) GENICAM_NAMESPACE::CLog::LogPop( cat, LOG4CPP_NS::Priority::INFO, ##__VA_ARGS__ )
00163 #define GCLOGWARN( cat, ... ) if(cat != NULL) GENICAM_NAMESPACE::CLog::Log( cat, LOG4CPP_NS::Priority::WARN, ##__VA_ARGS__ )
00164 #define GCLOGERROR( cat, ... ) if(cat != NULL) GENICAM_NAMESPACE::CLog::Log( cat, LOG4CPP_NS::Priority::ERROR, ##__VA_ARGS__ )
00165 #define GCLOGDEBUG( cat, ... ) if(cat != NULL) GENICAM_NAMESPACE::CLog::Log( cat, LOG4CPP_NS::Priority::DEBUG,  ##__VA_ARGS__ )
00166 
00167 
00168 #endif // LOG_CLOG_H_


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:02