unifi-protect: put debug spam behind debug flag

This commit is contained in:
Koushik Dutta
2021-11-07 12:58:44 -08:00
parent 159c64e359
commit e080fffbb3
3 changed files with 10 additions and 4 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/unifi-protect",
"version": "0.0.52",
"version": "0.0.53",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/unifi-protect",
"version": "0.0.52",
"version": "0.0.53",
"license": "Apache",
"dependencies": {
"@scrypted/sdk": "file:../../sdk",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/unifi-protect",
"version": "0.0.52",
"version": "0.0.53",
"description": "Unifi Protect Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",

View File

@@ -389,6 +389,11 @@ class UnifiProtect extends ScryptedDeviceBase implements Settings, DeviceProvide
};
debugLog(message: string, ...parameters: any[]) {
if (this.storage.getItem('debug'))
this.console.log(message, ...parameters);
}
async discoverDevices(duration: number) {
const ip = this.getSetting('ip');
const username = this.getSetting('username');
@@ -412,7 +417,8 @@ class UnifiProtect extends ScryptedDeviceBase implements Settings, DeviceProvide
}
if (!this.api) {
this.api = new ProtectApi(() => { }, this.console, ip, username, password);
this.api = new ProtectApi((message, ...parameters) =>
this.debugLog(message, ...parameters), this.console, ip, username, password);
}
try {