[libcalamares] Don't print funcinfo in continuations
- when a single function does more logging, it generally marks those as subsequent debug-messages (with Continuation, or SubEntry) and we don't need to print funcinfo for those, since it was already printed the first time.
This commit is contained in:
parent
5248a37eb3
commit
0abde6f1a7
@ -44,6 +44,10 @@ static unsigned int s_threshold =
|
|||||||
#endif
|
#endif
|
||||||
static QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
|
|
||||||
|
static const char s_Continuation[] = "\n ";
|
||||||
|
static const char s_SubEntry[] = " .. ";
|
||||||
|
|
||||||
|
|
||||||
namespace Logger
|
namespace Logger
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -192,14 +196,19 @@ CDebug::~CDebug()
|
|||||||
{
|
{
|
||||||
if ( m_funcinfo )
|
if ( m_funcinfo )
|
||||||
{
|
{
|
||||||
m_msg.prepend( Continuation );
|
m_msg.prepend( s_Continuation ); // Prepending, so back-to-front
|
||||||
m_msg.prepend( m_funcinfo );
|
m_msg.prepend( m_funcinfo );
|
||||||
}
|
}
|
||||||
log( m_msg.toUtf8().data(), m_debugLevel );
|
log( m_msg.toUtf8().data(), m_debugLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char Continuation[] = "\n ";
|
constexpr FuncSuppressor::FuncSuppressor( const char s[] )
|
||||||
const char SubEntry[] = " .. ";
|
: m_s( s )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const constexpr FuncSuppressor Continuation( s_Continuation );
|
||||||
|
const constexpr FuncSuppressor SubEntry( s_SubEntry );
|
||||||
|
|
||||||
QString
|
QString
|
||||||
toString( const QVariant& v )
|
toString( const QVariant& v )
|
||||||
|
@ -27,8 +27,14 @@
|
|||||||
|
|
||||||
namespace Logger
|
namespace Logger
|
||||||
{
|
{
|
||||||
DLLEXPORT extern const char Continuation[];
|
struct FuncSuppressor
|
||||||
DLLEXPORT extern const char SubEntry[];
|
{
|
||||||
|
explicit constexpr FuncSuppressor( const char[] );
|
||||||
|
const char* m_s;
|
||||||
|
};
|
||||||
|
|
||||||
|
DLLEXPORT extern const FuncSuppressor Continuation;
|
||||||
|
DLLEXPORT extern const FuncSuppressor SubEntry;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -47,12 +53,27 @@ public:
|
|||||||
explicit CDebug( unsigned int debugLevel = LOGDEBUG, const char* func = nullptr );
|
explicit CDebug( unsigned int debugLevel = LOGDEBUG, const char* func = nullptr );
|
||||||
virtual ~CDebug();
|
virtual ~CDebug();
|
||||||
|
|
||||||
|
friend QDebug& operator<<( CDebug&&, const FuncSuppressor& );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_msg;
|
QString m_msg;
|
||||||
unsigned int m_debugLevel;
|
unsigned int m_debugLevel;
|
||||||
const char* m_funcinfo = nullptr;
|
const char* m_funcinfo = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline QDebug&
|
||||||
|
operator<<( CDebug&& s, const FuncSuppressor& f )
|
||||||
|
{
|
||||||
|
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.
|
* @brief The full path of the log file.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user