Log message with QGIS Python script
A minimal example on how to add a message to Log Messages panel in a QGIS Python script.
from qgis.core import QgsMessageLog
from qgis.core import Qgis
QgsMessageLog.logMessage(message = 'This is an info message',
tag = 'Info',
level = Qgis.Info,
notifyUser = False)
QgsMessageLog.logMessage(message = 'This is a warning message',
tag = 'Warning',
level = Qgis.Warning,
notifyUser = True)
QgsMessageLog.logMessage(message = 'This is a critical error message',
tag = 'Critical',
level = Qgis.Critical,
notifyUser = True)