Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Jul 18, 2024
1 parent 3512ae1 commit 4927e54
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 27 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 18 additions & 14 deletions src/devices/DeviceBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,63 +102,67 @@ export abstract class DeviceBase {
*/
async infoLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
this.log.info(`${this.device.ipaddress}: ${this.accessory.displayName}`, String(...log));
this.log.info(`${this.accessory.displayName}`, String(...log));
}
}

async successLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
this.log.success(`${this.device.ipaddress}: ${this.accessory.displayName}`, String(...log));
this.log.success(`${this.accessory.displayName}`, String(...log));
}
}

async debugSuccessLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
if (this.deviceLogging?.includes('debug')) {
this.log.success(`[DEBUG] ${this.device.ipaddress}: ${this.accessory.displayName}`, String(...log));
if (await this.loggingIsDebug()) {
this.log.success(`[DEBUG] ${this.accessory.displayName}`, String(...log));
}
}
}

async warnLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
this.log.warn(`${this.device.ipaddress}: ${this.accessory.displayName}`, String(...log));
this.log.warn(`${this.accessory.displayName}`, String(...log));
}
}

async debugWarnLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
if (this.deviceLogging?.includes('debug')) {
this.log.warn(`[DEBUG] ${this.device.ipaddress}: ${this.accessory.displayName}`, String(...log));
if (await this.loggingIsDebug()) {
this.log.warn(`[DEBUG] ${this.accessory.displayName}`, String(...log));
}
}
}

async errorLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
this.log.error(`${this.device.ipaddress}: ${this.accessory.displayName}`, String(...log));
this.log.error(`${this.accessory.displayName}`, String(...log));
}
}

async debugErrorLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
if (this.deviceLogging?.includes('debug')) {
this.log.error(`[DEBUG] ${this.device.ipaddress}: ${this.accessory.displayName}`, String(...log));
if (await this.loggingIsDebug()) {
this.log.error(`[DEBUG] ${this.accessory.displayName}`, String(...log));
}
}
}

async debugLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
if (this.deviceLogging === 'debug') {
this.log.info(`[DEBUG] ${this.device.ipaddress}: ${this.accessory.displayName}`, String(...log));
} else {
this.log.debug(`${this.device.ipaddress}: ${this.accessory.displayName}`, String(...log));
this.log.info(`[DEBUG] ${this.accessory.displayName}`, String(...log));
} else if (this.deviceLogging === 'debugMode') {
this.log.debug(`${this.accessory.displayName}`, String(...log));
}
}
}

async loggingIsDebug(): Promise<boolean> {
return this.deviceLogging === 'debugMode' || this.deviceLogging === 'debug';
}

async enablingDeviceLogging(): Promise<boolean> {
return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
return this.deviceLogging === 'debugMode' || this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
}
}
24 changes: 14 additions & 10 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,17 +675,17 @@ export class RainbirdPlatform implements DynamicPlatformPlugin {
this.platformLogging = this.config.options?.logging ?? 'standard';
if (this.config.options?.logging === 'debug' || this.config.options?.logging === 'standard' || this.config.options?.logging === 'none') {
this.platformLogging = this.config.options.logging;
if (this.platformLogging?.includes('debug')) {
if (await this.loggingIsDebug()) {
this.debugWarnLog(`Using Config Logging: ${this.platformLogging}`);
}
} else if (this.debugMode) {
this.platformLogging = 'debugMode';
if (this.platformLogging?.includes('debug')) {
if (await this.loggingIsDebug()) {
this.debugWarnLog(`Using ${this.platformLogging} Logging`);
}
} else {
this.platformLogging = 'standard';
if (this.platformLogging?.includes('debug')) {
if (await this.loggingIsDebug()) {
this.debugWarnLog(`Using ${this.platformLogging} Logging`);
}
}
Expand Down Expand Up @@ -723,7 +723,7 @@ export class RainbirdPlatform implements DynamicPlatformPlugin {

async debugSuccessLog(...log: any[]): Promise<void> {
if (await this.enablingPlatformLogging()) {
if (this.platformLogging?.includes('debug')) {
if (await this.loggingIsDebug()) {
this.log.success('[DEBUG]', String(...log));
}
}
Expand All @@ -737,7 +737,7 @@ export class RainbirdPlatform implements DynamicPlatformPlugin {

async debugWarnLog(...log: any[]): Promise<void> {
if (await this.enablingPlatformLogging()) {
if (this.platformLogging?.includes('debug')) {
if (await this.loggingIsDebug()) {
this.log.warn('[DEBUG]', String(...log));
}
}
Expand All @@ -751,23 +751,27 @@ export class RainbirdPlatform implements DynamicPlatformPlugin {

async debugErrorLog(...log: any[]): Promise<void> {
if (await this.enablingPlatformLogging()) {
if (this.platformLogging?.includes('debug')) {
if (await this.loggingIsDebug()) {
this.log.error('[DEBUG]', String(...log));
}
}
}

async debugLog(...log: any[]): Promise<void> {
if (await this.enablingPlatformLogging()) {
if (this.platformLogging === 'debugMode') {
this.log.debug(String(...log));
} else if (this.platformLogging === 'debug') {
if (this.platformLogging === 'debug') {
this.log.info('[DEBUG]', String(...log));
} else if (this.platformLogging === 'debugMode') {
this.log.debug(String(...log));
}
}
}

async loggingIsDebug(): Promise<boolean> {
return this.platformLogging === 'debugMode' || this.platformLogging === 'debug';
}

async enablingPlatformLogging(): Promise<boolean> {
return this.platformLogging?.includes('debug') || this.platformLogging === 'standard';
return this.platformLogging === 'debugMode' || this.platformLogging === 'debug' || this.platformLogging === 'standard';
}
}

0 comments on commit 4927e54

Please sign in to comment.