[libcalamares] Allow Python to log an Error as well

This commit is contained in:
Adriaan de Groot 2021-11-29 12:22:02 +01:00
parent 8a1e5d35fa
commit e9970474f5
2 changed files with 14 additions and 2 deletions

View File

@ -139,17 +139,28 @@ check_target_env_output( const bp::list& args, const std::string& stdin, int tim
}
static const char output_prefix[] = "[PYTHON JOB]:";
static inline void
log_action( unsigned int level, const std::string& s )
{
Logger::CDebug( level ) << output_prefix << QString::fromStdString( s );
}
void
debug( const std::string& s )
{
Logger::CDebug( Logger::LOGDEBUG ) << output_prefix << QString::fromStdString( s );
log_action( Logger::LOGDEBUG, s );
}
void
warning( const std::string& s )
{
Logger::CDebug( Logger::LOGWARNING ) << output_prefix << QString::fromStdString( s );
log_action( Logger::LOGWARNING, s );
}
void
error( const std::string& s )
{
log_action( Logger::LOGERROR, s );
}
PythonJobInterface::PythonJobInterface( Calamares::PythonJob* parent )

View File

@ -60,6 +60,7 @@ boost::python::list gettext_languages();
void debug( const std::string& s );
void warning( const std::string& s );
void error( const std::string& s );
class PythonJobInterface
{