Format with qmlformat.
This commit is contained in:
@@ -9,47 +9,52 @@ import clide.module 1.0
|
||||
import Logger 1.0
|
||||
|
||||
Item {
|
||||
ListModel { id: model }
|
||||
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
|
||||
case "DEBUG":
|
||||
return RustColors.debug_log
|
||||
case "WARN":
|
||||
return RustColors.warn_log
|
||||
case "ERROR":
|
||||
return RustColors.error_log
|
||||
case "TRACE":
|
||||
return RustColors.trace_log
|
||||
default:
|
||||
return RustColors.info_log
|
||||
case "INFO":
|
||||
return RustColors.info_log;
|
||||
case "DEBUG":
|
||||
return RustColors.debug_log;
|
||||
case "WARN":
|
||||
return RustColors.warn_log;
|
||||
case "ERROR":
|
||||
return RustColors.error_log;
|
||||
case "TRACE":
|
||||
return RustColors.trace_log;
|
||||
default:
|
||||
return RustColors.info_log;
|
||||
}
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
model: model
|
||||
|
||||
delegate: Text {
|
||||
text: `[${level}] ${message}`
|
||||
font.family: "monospace"
|
||||
color: listView.getLogColor(level)
|
||||
font.family: "monospace"
|
||||
text: `[${level}] ${message}`
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Logger
|
||||
function onLogged(level, message) {
|
||||
model.append({ level, message })
|
||||
model.append({
|
||||
level,
|
||||
message
|
||||
});
|
||||
}
|
||||
|
||||
target: Logger
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user