QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
21 #include <QTextStream>
29 QgsDebugMsg( QStringLiteral(
"%1 %2[%3] %4" ).arg( QDateTime::currentDateTime().toString( Qt::ISODate ), tag ).arg(
static_cast< int >( level ) ).arg( message ) );
34 void QgsMessageLog::emitMessage(
const QString &message,
const QString &tag,
Qgis::MessageLevel level,
bool notifyUser )
37 if ( level != Qgis::MessageLevel::Info && notifyUser && mAdviseBlockCount == 0 )
53 QTextStream cerr( stderr );
54 cerr << formattedMessage;
59 const QString time = QTime::currentTime().toString();
60 const QString levelStr = level == Qgis::MessageLevel::Info ? QStringLiteral(
"INFO" ) :
61 level == Qgis::MessageLevel::Warning ? QStringLiteral(
"WARNING" ) :
62 QStringLiteral(
"CRITICAL" );
63 const QString pid = QString::number( QCoreApplication::applicationPid() );
64 return QStringLiteral(
"%1 %2 %3[%4]: %5\n" ).arg( time, levelStr, tag, pid, message );
QString formatLogMessage(const QString &message, const QString &tag, Qgis::MessageLevel level=Qgis::MessageLevel::Info) const
Formats a log message.
void messageReceived(const QString &message, const QString &tag, Qgis::MessageLevel level)
Emitted whenever the log receives a message.
QgsMessageLogConsole()
Constructor for QgsMessageLogConsole.
static QgsMessageLog * messageLog()
Returns the application's message log.
virtual void logMessage(const QString &message, const QString &tag, Qgis::MessageLevel level)
Logs a message to stderr.
Interface for logging messages from QGIS in GUI independent way.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Extends QApplication to provide access to QGIS specific resources such as theme paths,...
~QgsMessageLogNotifyBlocker()
MessageLevel
Level for messages This will be used both for message log and message bar in application.
QgsMessageLogNotifyBlocker()
Constructor for QgsMessageLogNotifyBlocker.
Default implementation of message logging interface.