mirror of
https://github.com/koush/scrypted.git
synced 2026-02-10 09:12:03 +00:00
unifi-protect: put debug spam behind debug flag
This commit is contained in:
4
plugins/unifi-protect/package-lock.json
generated
4
plugins/unifi-protect/package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user