Add basic debug logger.

This commit is contained in:
2026-02-01 20:20:39 -05:00
parent be383869b2
commit e5b91eaed8
9 changed files with 125 additions and 22 deletions

58
qml/ClideLogger.qml Normal file
View File

@@ -0,0 +1,58 @@
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
import QtQuick
import QtQuick.Controls
import clide.module 1.0
import Logger 1.0
Item {
ListModel { id: model }
Rectangle {
anchors.fill: parent
color: "#111"
}
ListView {
id: listView
anchors.fill: parent
model: model
clip: true
function getLogColor(level) {
switch (level) {
case "INFO":
return RustColors.info_log
break;
case "DEBUG":
return RustColors.debug_log
break;
case "WARN":
return RustColors.warn_log
break;
case "ERROR":
return RustColors.error_log
break;
default:
return RustColors.info_log
break;
}
}
delegate: Text {
text: `[${level}] ${message}`
font.family: "monospace"
color: listView.getLogColor(level)
}
}
Connections {
target: Logger
function onLogged(level, message) {
model.append({ level, message })
}
}
}