Using a custom logger with colors and timestamp instead of console.xxx

This commit is contained in:
quadbyte 2025-08-16 19:31:22 -04:00
parent 4794477be3
commit e800bc161d
34 changed files with 278 additions and 236 deletions

View file

@ -156,13 +156,13 @@ Singleton {
readonly property Process initProc: Process {
stdout: StdioCollector {
onStreamFinished: {
console.log("[Brightness] Raw brightness data for", monitor.modelData.name + ":", text.trim())
Logger.log("Brightness", "Raw brightness data for", monitor.modelData.name + ":", text.trim())
if (monitor.isAppleDisplay) {
var val = parseInt(text.trim())
if (!isNaN(val)) {
monitor.brightness = val / 101
console.log("[Brightness] Apple display brightness:", monitor.brightness)
Logger.log("Brightness", "Apple display brightness:", monitor.brightness)
}
} else if (monitor.isDdc) {
var parts = text.trim().split(" ")
@ -171,7 +171,7 @@ Singleton {
var max = parseInt(parts[1])
if (!isNaN(current) && !isNaN(max) && max > 0) {
monitor.brightness = current / max
console.log("[Brightness] DDC brightness:", current + "/" + max + " =", monitor.brightness)
Logger.log("Brightness", "DDC brightness:", current + "/" + max + " =", monitor.brightness)
}
}
} else {
@ -182,7 +182,7 @@ Singleton {
var max = parseInt(parts[1])
if (!isNaN(current) && !isNaN(max) && max > 0) {
monitor.brightness = current / max
console.log("[Brightness] Internal brightness:", current + "/" + max + " =", monitor.brightness)
Logger.log("Brightness", "Internal brightness:", current + "/" + max + " =", monitor.brightness)
}
}
}