mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[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
1 changed files with 16 additions and 11 deletions
|
@ -50,7 +50,7 @@ static unsigned int s_threshold =
|
|||
static QMutex s_mutex;
|
||||
|
||||
static const char s_Continuation[] = "\n ";
|
||||
static const char s_SubEntry[] = " .. ";
|
||||
static const char s_SubEntry[] = " .. ";
|
||||
|
||||
|
||||
namespace Logger
|
||||
|
@ -79,7 +79,7 @@ logLevel()
|
|||
}
|
||||
|
||||
static void
|
||||
log( const char* msg, unsigned int debugLevel )
|
||||
log( const char* msg, unsigned int debugLevel, bool withTime = true )
|
||||
{
|
||||
if ( true )
|
||||
{
|
||||
|
@ -95,13 +95,15 @@ log( const char* msg, unsigned int debugLevel )
|
|||
logfile.flush();
|
||||
}
|
||||
|
||||
if ( logLevelEnabled(debugLevel) )
|
||||
if ( logLevelEnabled( debugLevel ) )
|
||||
{
|
||||
QMutexLocker lock( &s_mutex );
|
||||
|
||||
std::cout << QTime::currentTime().toString().toUtf8().data() << " ["
|
||||
<< QString::number( debugLevel ).toUtf8().data() << "]: " << msg << std::endl;
|
||||
std::cout.flush();
|
||||
if ( withTime )
|
||||
{
|
||||
std::cout << QTime::currentTime().toString().toUtf8().data() << " ["
|
||||
<< QString::number( debugLevel ).toUtf8().data() << "]: ";
|
||||
}
|
||||
std::cout << msg << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,12 +201,15 @@ CDebug::CDebug( unsigned int debugLevel, const char* func )
|
|||
|
||||
CDebug::~CDebug()
|
||||
{
|
||||
if ( m_funcinfo )
|
||||
if ( logLevelEnabled( m_debugLevel ) )
|
||||
{
|
||||
m_msg.prepend( s_Continuation ); // Prepending, so back-to-front
|
||||
m_msg.prepend( m_funcinfo );
|
||||
if ( 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[] )
|
||||
|
|
Loading…
Add table
Reference in a new issue