|
|
|
@ -27,8 +27,14 @@
|
|
|
|
|
|
|
|
|
|
namespace Logger
|
|
|
|
|
{
|
|
|
|
|
DLLEXPORT extern const char Continuation[];
|
|
|
|
|
DLLEXPORT extern const char SubEntry[];
|
|
|
|
|
struct FuncSuppressor
|
|
|
|
|
{
|
|
|
|
|
explicit constexpr FuncSuppressor( const char[] );
|
|
|
|
|
const char* m_s;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DLLEXPORT extern const FuncSuppressor Continuation;
|
|
|
|
|
DLLEXPORT extern const FuncSuppressor SubEntry;
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
@ -41,34 +47,32 @@ enum
|
|
|
|
|
LOGVERBOSE = 8
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class DLLEXPORT CLog : public QDebug
|
|
|
|
|
class DLLEXPORT CDebug : public QDebug
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit CLog( unsigned int debugLevel );
|
|
|
|
|
virtual ~CLog();
|
|
|
|
|
explicit CDebug( unsigned int debugLevel = LOGDEBUG, const char* func = nullptr );
|
|
|
|
|
virtual ~CDebug();
|
|
|
|
|
|
|
|
|
|
friend QDebug& operator<<( CDebug&&, const FuncSuppressor& );
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_msg;
|
|
|
|
|
unsigned int m_debugLevel;
|
|
|
|
|
const char* m_funcinfo = nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class DLLEXPORT CDebug : public CLog
|
|
|
|
|
inline QDebug&
|
|
|
|
|
operator<<( CDebug&& s, const FuncSuppressor& f )
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CDebug( unsigned int debugLevel = LOGDEBUG )
|
|
|
|
|
: CLog( debugLevel )
|
|
|
|
|
{
|
|
|
|
|
if ( debugLevel <= LOGERROR )
|
|
|
|
|
{
|
|
|
|
|
*this << "ERROR:";
|
|
|
|
|
}
|
|
|
|
|
else if ( debugLevel <= LOGWARNING )
|
|
|
|
|
{
|
|
|
|
|
*this << "WARNING:";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
virtual ~CDebug();
|
|
|
|
|
};
|
|
|
|
|
s.m_funcinfo = nullptr;
|
|
|
|
|
return s << f.m_s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline QDebug&
|
|
|
|
|
operator<<( QDebug& s, const FuncSuppressor& f )
|
|
|
|
|
{
|
|
|
|
|
return s << f.m_s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief The full path of the log file.
|
|
|
|
@ -219,8 +223,8 @@ operator<<( QDebug& s, const DebugMap& t )
|
|
|
|
|
}
|
|
|
|
|
} // namespace Logger
|
|
|
|
|
|
|
|
|
|
#define cDebug() (Logger::CDebug( Logger::LOGDEBUG ) << Q_FUNC_INFO << Logger::Continuation)
|
|
|
|
|
#define cWarning() Logger::CDebug( Logger::LOGWARNING )
|
|
|
|
|
#define cError() Logger::CDebug( Logger::LOGERROR )
|
|
|
|
|
#define cDebug() Logger::CDebug( Logger::LOGDEBUG, Q_FUNC_INFO )
|
|
|
|
|
#define cWarning() Logger::CDebug( Logger::LOGWARNING, Q_FUNC_INFO )
|
|
|
|
|
#define cError() Logger::CDebug( Logger::LOGERROR, Q_FUNC_INFO )
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|