From 3596b48c7a69b5275076269dd5749b8632c38ffb Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 27 Jul 2021 16:01:32 +0200 Subject: [PATCH] [libcalamares] Factor out common string in Python logging - enforce consistent [PYTHON JOB] - use CDebug() constructor, because the convenience macro's introduce the function name -- that's the C++ function, so it isn't useful for logging. --- src/libcalamares/PythonJobApi.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index 41fb82151..d61cfc223 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -136,16 +136,18 @@ check_target_env_output( const bp::list& args, const std::string& stdin, int tim return ec.second.toStdString(); } +static const char output_prefix[] = "[PYTHON JOB]:"; + void debug( const std::string& s ) { - Logger::CDebug( Logger::LOGDEBUG ) << "[PYTHON JOB]: " << QString::fromStdString( s ); + Logger::CDebug( Logger::LOGDEBUG ) << output_prefix << QString::fromStdString( s ); } void warning( const std::string& s ) { - cWarning() << "[PYTHON JOB]: " << QString::fromStdString( s ); + Logger::CDebug( Logger::LOGWARNING ) << output_prefix << QString::fromStdString( s ); } PythonJobInterface::PythonJobInterface( Calamares::PythonJob* parent ) @@ -168,7 +170,6 @@ PythonJobInterface::setprogress( qreal progress ) } } - std::string obscure( const std::string& string ) {