-
Notifications
You must be signed in to change notification settings - Fork 1
/
logger.mjs
39 lines (37 loc) · 1.42 KB
/
logger.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function printer(str, element) {
return (element || element == 0) ? " " + str + ": " + element : "";
}
export async function prettyPrint(debug) {
let log = "";
let parameters = {
"device": "deviceId",
"time": "time",
"pm2.5": "pm25",
"level": "level",
"humidity": "humidity",
"temperature": "temperature",
"mode": "mode",
"sunriseEnd": "sunriseEnd",
"night": "night",
"nightMode": "nightMode",
"disableLedAtNight": "disableLedAtNight",
"criticalLevelDisplay": "criticalLevelDisplay",
"unconditionalBoostLevel": "unconditionalBoostLevel",
"overridePurifierMode": "overridePurifierMode",
"hysteresis": "hysteresis",
"advancedHysteresisUp": "advancedHysteresisUp",
"advancedHysteresisDown": "advancedHysteresisDown",
"ifTurnedOnOverridePurifierMode": "ifTurnedOnOverridePurifierMode",
"preventHighTemperature": "preventHighTemperature",
"dayEnableCoolingDownSpeed": "dayEnableCoolingDownSpeed",
"preventLowHumidity": "preventLowHumidity",
"preventLowTemperature": "preventLowTemperature",
"criticalHumidityThreshold": "criticalHumidityThreshold",
};
let k = Object.keys(parameters);
let v = Object.values(parameters);
for (let i = 0; i < k.length; ++i) {
log += printer(k[i], debug[v[i]]);
}
console.log("{" + log + "}");
}