[libcalamares] Massage the logger output
- continuations, for the console, no longer print the date + level, which makes things easier to visually group and read. - the file log is mostly unchanged, except it contains more spaces now.
This commit is contained in:
parent
631923abf8
commit
3565b6806a
@ -50,7 +50,7 @@ static unsigned int s_threshold =
|
|||||||
static QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
|
|
||||||
static const char s_Continuation[] = "\n ";
|
static const char s_Continuation[] = "\n ";
|
||||||
static const char s_SubEntry[] = " .. ";
|
static const char s_SubEntry[] = " .. ";
|
||||||
|
|
||||||
|
|
||||||
namespace Logger
|
namespace Logger
|
||||||
@ -79,7 +79,7 @@ logLevel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
log( const char* msg, unsigned int debugLevel )
|
log( const char* msg, unsigned int debugLevel, bool withTime = true )
|
||||||
{
|
{
|
||||||
if ( true )
|
if ( true )
|
||||||
{
|
{
|
||||||
@ -95,13 +95,15 @@ log( const char* msg, unsigned int debugLevel )
|
|||||||
logfile.flush();
|
logfile.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( logLevelEnabled(debugLevel) )
|
if ( logLevelEnabled( debugLevel ) )
|
||||||
{
|
{
|
||||||
QMutexLocker lock( &s_mutex );
|
QMutexLocker lock( &s_mutex );
|
||||||
|
if ( withTime )
|
||||||
std::cout << QTime::currentTime().toString().toUtf8().data() << " ["
|
{
|
||||||
<< QString::number( debugLevel ).toUtf8().data() << "]: " << msg << std::endl;
|
std::cout << QTime::currentTime().toString().toUtf8().data() << " ["
|
||||||
std::cout.flush();
|
<< QString::number( debugLevel ).toUtf8().data() << "]: ";
|
||||||
|
}
|
||||||
|
std::cout << msg << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,12 +201,15 @@ CDebug::CDebug( unsigned int debugLevel, const char* func )
|
|||||||
|
|
||||||
CDebug::~CDebug()
|
CDebug::~CDebug()
|
||||||
{
|
{
|
||||||
if ( m_funcinfo )
|
if ( logLevelEnabled( m_debugLevel ) )
|
||||||
{
|
{
|
||||||
m_msg.prepend( s_Continuation ); // Prepending, so back-to-front
|
if ( m_funcinfo )
|
||||||
m_msg.prepend( m_funcinfo );
|
{
|
||||||
|
m_msg.prepend( s_Continuation ); // Prepending, so back-to-front
|
||||||
|
m_msg.prepend( m_funcinfo );
|
||||||
|
}
|
||||||
|
log( m_msg.toUtf8().data(), m_debugLevel, m_funcinfo );
|
||||||
}
|
}
|
||||||
log( m_msg.toUtf8().data(), m_debugLevel );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr FuncSuppressor::FuncSuppressor( const char s[] )
|
constexpr FuncSuppressor::FuncSuppressor( const char s[] )
|
||||||
|
Loading…
Reference in New Issue
Block a user