31 case Qgis::MessageLevel::Info:
32 case Qgis::MessageLevel::Success:
33 case Qgis::MessageLevel::NoLevel:
34 QgsDebugMsgLevel( QStringLiteral(
"%1 %2[%3] %4" ).arg( QDateTime::currentDateTime().toString( Qt::ISODate ), tag ).arg(
static_cast< int >( level ) ).arg( message ), 1 );
37 case Qgis::MessageLevel::Warning:
38 case Qgis::MessageLevel::Critical:
39 QgsDebugError( QStringLiteral(
"%1 %2[%3] %4" ).arg( QDateTime::currentDateTime().toString( Qt::ISODate ), tag ).arg(
static_cast< int >( level ) ).arg( message ) );
46void QgsMessageLog::emitMessage(
const QString &message,
const QString &tag,
Qgis::MessageLevel level,
bool notifyUser )
49 if ( level != Qgis::MessageLevel::Info && notifyUser && mAdviseBlockCount == 0 )
65 QTextStream cerr( stderr );
66 cerr << formattedMessage;
71 const QString time = QTime::currentTime().toString();
72 const QString levelStr = level == Qgis::MessageLevel::Info ? QStringLiteral(
"INFO" ) :
73 level == Qgis::MessageLevel::Warning ? QStringLiteral(
"WARNING" ) :
74 QStringLiteral(
"CRITICAL" );
75 const QString pid = QString::number( QCoreApplication::applicationPid() );
76 return QStringLiteral(
"%1 %2 %3[%4]: %5\n" ).arg( time, levelStr, tag, pid, message );
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Extends QApplication to provide access to QGIS specific resources such as theme paths,...
static QgsMessageLog * messageLog()
Returns the application's message log.
Default implementation of message logging interface.
QString formatLogMessage(const QString &message, const QString &tag, Qgis::MessageLevel level=Qgis::MessageLevel::Info) const
Formats a log message.
QgsMessageLogConsole()
Constructor for QgsMessageLogConsole.
virtual void logMessage(const QString &message, const QString &tag, Qgis::MessageLevel level)
Logs a message to stderr.
~QgsMessageLogNotifyBlocker()
QgsMessageLogNotifyBlocker()
Constructor for QgsMessageLogNotifyBlocker.
Interface for logging messages from QGIS in GUI independent way.
void messageReceived(const QString &message, const QString &tag, Qgis::MessageLevel level)
Emitted whenever the log receives a message.
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).
#define QgsDebugMsgLevel(str, level)
#define QgsDebugError(str)