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

@ -14,12 +14,12 @@ NIconButton {
sizeMultiplier: 0.8
showBorder: false
visible: bluetoothEnabled
Component.onCompleted: {
console.log("[Bluetooth] Component loaded, bluetoothEnabled:", bluetoothEnabled)
console.log("[Bluetooth] BluetoothService available:", typeof BluetoothService !== 'undefined')
Logger.log("Bluetooth", "Component loaded, bluetoothEnabled:", bluetoothEnabled)
Logger.log("Bluetooth", "BluetoothService available:", typeof BluetoothService !== 'undefined')
if (typeof BluetoothService !== 'undefined') {
console.log("[Bluetooth] Connected devices:", BluetoothService.connectedDevices.length)
Logger.log("Bluetooth", "Connected devices:", BluetoothService.connectedDevices.length)
}
}
icon: {
@ -55,4 +55,4 @@ NIconButton {
BluetoothMenu {
id: bluetoothMenuLoader
}
}
}

View file

@ -214,34 +214,34 @@ NLoader {
// Combine all devices into a single list for the ListView
property var allDevices: {
const devices = []
// Add connected devices first
for (const device of BluetoothService.connectedDevices) {
devices.push({
device: device,
type: 'connected',
section: 'Connected Devices'
})
"device": device,
"type": 'connected',
"section": 'Connected Devices'
})
}
// Add paired devices
for (const device of BluetoothService.pairedDevices) {
devices.push({
device: device,
type: 'paired',
section: 'Paired Devices'
})
"device": device,
"type": 'paired',
"section": 'Paired Devices'
})
}
// Add available devices
for (const device of BluetoothService.availableDevices) {
devices.push({
device: device,
type: 'available',
section: 'Available Devices'
})
"device": device,
"type": 'available',
"section": 'Available Devices'
})
}
return devices
}
@ -362,9 +362,8 @@ NLoader {
// Empty state when no devices found
ColumnLayout {
anchors.centerIn: parent
visible: Settings.data.network.bluetoothEnabled &&
!BluetoothService.isDiscovering &&
deviceList.count === 0
visible: Settings.data.network.bluetoothEnabled && !BluetoothService.isDiscovering
&& deviceList.count === 0
spacing: Style.marginMedium * scaling
NText {
@ -394,4 +393,4 @@ NLoader {
}
}
}
}
}

View file

@ -100,7 +100,7 @@ Item {
trayPanel.show()
} else {
console.log("[Tray] no menu available for", modelData.id, "or trayMenu not set")
Logger.log("Tray", "No menu available for", modelData.id, "or trayMenu not set")
}
}
}

View file

@ -44,7 +44,7 @@ PopupWindow {
function showAt(item, x, y) {
if (!item) {
console.warn("CustomTrayMenu: anchorItem is undefined, won't show menu.")
Logger.warn("TrayMenu", "anchorItem is undefined, won't show menu.")
return
}
anchorItem = item
@ -267,7 +267,7 @@ PopupWindow {
function showAt(item, x, y) {
if (!item) {
console.warn("subMenuComponent: anchorItem is undefined, not showing menu.")
Logger.warn("TrayMenu", "SubComponent anchorItem is undefined, not showing menu.")
return
}
anchorItem = item

View file

@ -26,7 +26,7 @@ Item {
Connections {
target: AudioService.sink?.audio ? AudioService.sink?.audio : null
function onVolumeChanged() {
// console.log("[Bar:Volume] onVolumeChanged")
// Logger.log("Bar:Volume", "onVolumeChanged")
if (!firstVolumeReceived) {
// Ignore the first volume change
firstVolumeReceived = true

View file

@ -145,8 +145,6 @@ NLoader {
Layout.fillWidth: true
}
NIconButton {
icon: "refresh"
tooltipText: "Refresh Networks"