ホーム » QGIS » QGIS(Pythonでログ出力)

QGIS(Pythonでログ出力)

class HelloWorld:
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        self.canvas = iface.mapCanvas()
        QgsMessageLog.logMessage("__init__", 'HelloWorld', QgsMessageLog.INFO)

QGISのログパネルに出力される
無題

QGIS3ではこんなかんじ

[code]
from qgis.core import Qgis, QgsMessageLog
import configparser
import os

#======================================================================
# ログクラス
#======================================================================
class Trace:
def __init__(self):
print(‘init’)
@staticmethod
def info(tag, msg):
QgsMessageLog.logMessage(msg, tag, Qgis.Info)

[/code]