[libcalamares] Add FUNC_INFO into all debug messages

- This is needlessly verbose
- Chase CreatePartitionTableJob which needs to bind to a temporary
main
Adriaan de Groot 5 years ago
parent 3ddee8090c
commit 5248a37eb3

@ -172,9 +172,10 @@ setupLogfile()
qInstallMessageHandler( CalamaresLogHandler ); qInstallMessageHandler( CalamaresLogHandler );
} }
CDebug::CDebug( unsigned int debugLevel ) CDebug::CDebug( unsigned int debugLevel, const char* func )
: QDebug( &m_msg ) : QDebug( &m_msg )
, m_debugLevel( debugLevel ) , m_debugLevel( debugLevel )
, m_funcinfo( func )
{ {
if ( debugLevel <= LOGERROR ) if ( debugLevel <= LOGERROR )
{ {
@ -189,6 +190,11 @@ CDebug::CDebug( unsigned int debugLevel )
CDebug::~CDebug() CDebug::~CDebug()
{ {
if ( m_funcinfo )
{
m_msg.prepend( Continuation );
m_msg.prepend( m_funcinfo );
}
log( m_msg.toUtf8().data(), m_debugLevel ); log( m_msg.toUtf8().data(), m_debugLevel );
} }

@ -44,12 +44,13 @@ enum
class DLLEXPORT CDebug : public QDebug class DLLEXPORT CDebug : public QDebug
{ {
public: public:
explicit CDebug( unsigned int debugLevel = LOGDEBUG ); explicit CDebug( unsigned int debugLevel = LOGDEBUG, const char* func = nullptr );
virtual ~CDebug(); virtual ~CDebug();
private: private:
QString m_msg; QString m_msg;
unsigned int m_debugLevel; unsigned int m_debugLevel;
const char* m_funcinfo = nullptr;
}; };
/** /**
@ -201,8 +202,8 @@ operator<<( QDebug& s, const DebugMap& t )
} }
} // namespace Logger } // namespace Logger
#define cDebug() ( Logger::CDebug( Logger::LOGDEBUG ) << Q_FUNC_INFO << Logger::Continuation ) #define cDebug() Logger::CDebug( Logger::LOGDEBUG, Q_FUNC_INFO )
#define cWarning() Logger::CDebug( Logger::LOGWARNING ) #define cWarning() Logger::CDebug( Logger::LOGWARNING, Q_FUNC_INFO )
#define cError() Logger::CDebug( Logger::LOGERROR ) #define cError() Logger::CDebug( Logger::LOGERROR, Q_FUNC_INFO )
#endif #endif

@ -69,7 +69,7 @@ CreatePartitionTableJob::prettyStatusMessage() const
static inline QDebug& static inline QDebug&
operator <<( QDebug& s, PartitionIterator& it ) operator <<( QDebug&& s, PartitionIterator& it )
{ {
s << ( ( *it ) ? ( *it )->deviceNode() : QString( "<null device>" ) ); s << ( ( *it ) ? ( *it )->deviceNode() : QString( "<null device>" ) );
return s; return s;

Loading…
Cancel
Save