Network/Wi-Fi: smarter logging to avoid flood
This commit is contained in:
parent
3d9ef8c2ed
commit
5bc8f410e7
2 changed files with 11 additions and 6 deletions
|
|
@ -30,7 +30,7 @@ NIconButton {
|
||||||
|
|
||||||
icon: {
|
icon: {
|
||||||
try {
|
try {
|
||||||
if (NetworkService.ethernet) {
|
if (NetworkService.ethernetConnected) {
|
||||||
return "lan"
|
return "lan"
|
||||||
}
|
}
|
||||||
let connected = false
|
let connected = false
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ Singleton {
|
||||||
property bool connecting: false
|
property bool connecting: false
|
||||||
property string connectingTo: ""
|
property string connectingTo: ""
|
||||||
property string lastError: ""
|
property string lastError: ""
|
||||||
property bool ethernet: false
|
property bool ethernetConnected: false
|
||||||
|
|
||||||
// Persistent cache
|
// Persistent cache
|
||||||
property string cacheFile: Settings.cacheDir + "network.json"
|
property string cacheFile: Settings.cacheDir + "network.json"
|
||||||
|
|
@ -169,12 +169,14 @@ Singleton {
|
||||||
|
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
|
const connected = text.split("\n").some(line => {
|
||||||
root.ethernet = text.split("\n").some(line => {
|
|
||||||
const parts = line.split(":")
|
const parts = line.split(":")
|
||||||
return parts[1] === "ethernet" && parts[2] === "connected"
|
return parts[1] === "ethernet" && parts[2] === "connected"
|
||||||
})
|
})
|
||||||
Logger.log("Network", "Ethernet connected:", root.ethernet)
|
if (root.ethernetConnected !== connected) {
|
||||||
|
root.ethernetConnected = connected
|
||||||
|
Logger.log("Network", "Ethernet connected:", root.ethernetConnected)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -286,9 +288,12 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (JSON.stringify(root.networks) !== JSON.stringify(nets)) {
|
||||||
|
Logger.log("Network", "Discovered", Object.keys(nets).length, "Wi-Fi networks")
|
||||||
|
}
|
||||||
root.networks = nets
|
root.networks = nets
|
||||||
root.scanning = false
|
root.scanning = false
|
||||||
Logger.log("Network", "Discovered", Object.keys(root.networks).length, "Wi-Fi networks")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue