[libcalamares] Improve Once-logging

Sending a Once to a logger that isn't enabled should not "consume"
that Once; it's still available for a subsequent logger that **is**
enabled (useful if you're using more than one log-level in a function).
This commit is contained in:
Adriaan de Groot 2021-06-18 16:10:13 +02:00
parent 66f96e339c
commit 432154e50a

View File

@ -60,6 +60,8 @@ public:
friend CDebug& operator<<( CDebug&&, const FuncSuppressor& );
friend CDebug& operator<<( CDebug&&, const Once& );
inline unsigned int level() const { return m_debugLevel; }
private:
QString m_msg;
unsigned int m_debugLevel;
@ -315,6 +317,12 @@ private:
inline CDebug&
operator<<( CDebug&& s, const Once& o )
{
if ( !logLevelEnabled( s.level() ) )
{
// This won't print, so it's not using the "onceness"
return s;
}
if ( o.m )
{
o.m = false;