Files
Include/EgtILogger.h
Dario Sassi 04a9005246 Include :
- aggiornamento interfacce
- correzione macro di Logger.
2015-02-14 09:34:06 +00:00

61 lines
2.6 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EgtILogger.h Data : 09.12.13 Versione : 1.4a4
// Contenuto : Interfaccia per logger.
//
//
//
// Modifiche : 09.12.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
//----------------------------------------------------------------------------
#define LOG_DATETIME( pLog, szText) { if ( (pLog) != nullptr) \
(pLog)->Log( LL_INFO, LI_DATETIME, nullptr, 0, nullptr, szText) ; }
#define LOG_INFO( pLog, szText) { if ( (pLog) != nullptr) \
(pLog)->Log( LL_INFO, LI_NONE, nullptr, 0, nullptr, szText) ; }
#define LOG_WARN( pLog, szText) { if ( (pLog) != nullptr) \
(pLog)->Log( LL_WARN, LI_NONE, nullptr, 0, nullptr, szText) ; }
#define LOG_ERROR( pLog, szText) { if ( (pLog) != nullptr) \
(pLog)->Log( LL_ERROR, LI_NONE, nullptr, 0, nullptr, szText) ; }
#define LOG_DBG_INFO( pLog, szText) { if ( (pLog) != nullptr) \
(pLog)->Log( LL_DEBUG, LI_NONE, nullptr, 0, nullptr, szText) ; }
#define LOG_DBG_ERR( pLog, szText) { if ( (pLog) != nullptr) \
(pLog)->Log( LL_DEBUG, __FILE__, __LINE__, __FUNCTION__, szText) ; }
#define LOG( pLog, nLev, nItem, szText) { if ( (pLog) != nullptr) \
(pLog)->Log( nLev, nItem, __FILE__, __LINE__, __FUNCTION__, szText) ; }
//----------------------------------------------------------------------------
enum LogLevel
{
LL_DEBUG = 1,
LL_INFO,
LL_WARN,
LL_ERROR
} ;
//----------------------------------------------------------------------------
enum LogItem
{
LI_NONE = 0x0,
LI_FILENAME = 0x1,
LI_LINENUMBER = 0x2,
LI_FUNCTION = 0x4,
LI_DATETIME = 0x8,
LI_THREADID = 0x10,
LI_LOGGERNAME = 0x20,
LI_LOGGERLEVEL = 0x40
} ;
//----------------------------------------------------------------------------
class __declspec( novtable) ILogger
{
public :
virtual void Log( LogLevel nLevel, const char* szFile, int nLine, const char* szFunc, const char* szText) = 0 ;
virtual void Log( LogLevel nLevel, int nItem, const char* szFile, int nLine, const char* szFunc, const char* szText) = 0 ;
} ;