19 #include <QTextStream>
23 QString QgsSaveLogToFileAlgorithm::name()
const
25 return QStringLiteral(
"savelog" );
28 QgsProcessingAlgorithm::Flags QgsSaveLogToFileAlgorithm::flags()
const
33 QString QgsSaveLogToFileAlgorithm::displayName()
const
35 return QObject::tr(
"Save log to file" );
38 QStringList QgsSaveLogToFileAlgorithm::tags()
const
40 return QObject::tr(
"record,messages,logged" ).split(
',' );
43 QString QgsSaveLogToFileAlgorithm::group()
const
45 return QObject::tr(
"Modeler tools" );
48 QString QgsSaveLogToFileAlgorithm::groupId()
const
50 return QStringLiteral(
"modelertools" );
53 QString QgsSaveLogToFileAlgorithm::shortHelpString()
const
55 return QObject::tr(
"This algorithm saves the model's execution log to a file.\n"
56 "Optionally, the log can be saved in a HTML formatted version." );
59 QString QgsSaveLogToFileAlgorithm::shortDescription()
const
61 return QObject::tr(
"Saves the model's log contents to a file." );
64 QgsSaveLogToFileAlgorithm *QgsSaveLogToFileAlgorithm::createInstance()
const
66 return new QgsSaveLogToFileAlgorithm();
69 void QgsSaveLogToFileAlgorithm::initAlgorithm(
const QVariantMap & )
77 const QString file = parameterAsFile( parameters, QStringLiteral(
"OUTPUT" ), context );
78 const bool useHtml = parameterAsBool( parameters, QStringLiteral(
"USE_HTML" ), context );
79 if ( !file.isEmpty() )
81 QFile exportFile( file );
82 if ( !exportFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
86 QTextStream fout( &exportFile );
87 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
88 fout.setCodec(
"UTF-8" );
93 res.insert( QStringLiteral(
"OUTPUT" ), file );
virtual Flags flags() const
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
virtual QString textLog() const
Returns the plain text contents of the log, which contains all messages pushed to the feedback object...
virtual QString htmlLog() const
Returns the HTML formatted contents of the log, which contains all messages pushed to the feedback ob...
A boolean parameter for processing algorithms.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...