fix(daemon): Adjust console log box formatting for consistent output in daemon status messages

This commit is contained in:
Philipp Kunz 2025-03-26 18:04:12 +00:00
parent d049e8741f
commit 65444b6d25
3 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
## 2025-03-26 - 2.6.10 - fix(daemon)
Adjust console log box formatting for consistent output in daemon status messages
- Updated closing box borders to align properly in configuration error, periodic updates, and UPS status logs
- Improved visual consistency in log messages
## 2025-03-26 - 2.6.9 - fix(cli) ## 2025-03-26 - 2.6.9 - fix(cli)
Improve console output formatting for status banners and logging messages Improve console output formatting for status banners and logging messages

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/nupst', name: '@serve.zone/nupst',
version: '2.6.9', version: '2.6.10',
description: 'Node.js UPS Shutdown Tool for SNMP-enabled UPS devices' description: 'Node.js UPS Shutdown Tool for SNMP-enabled UPS devices'
} }

View File

@ -125,7 +125,7 @@ export class NupstDaemon {
console.error('┌─ Configuration Error ─────────────────────┐'); console.error('┌─ Configuration Error ─────────────────────┐');
console.error(`${message}`); console.error(`${message}`);
console.error('│ Please run \'nupst setup\' first to create a configuration.'); console.error('│ Please run \'nupst setup\' first to create a configuration.');
console.error('└──────────────────────────────────────────┘'); console.error('└──────────────────────────────────────────┘');
} }
/** /**
@ -196,7 +196,7 @@ export class NupstDaemon {
console.log(`│ Battery: ${this.config.thresholds.battery}%`); console.log(`│ Battery: ${this.config.thresholds.battery}%`);
console.log(`│ Runtime: ${this.config.thresholds.runtime} minutes`); console.log(`│ Runtime: ${this.config.thresholds.runtime} minutes`);
console.log(`│ Check Interval: ${this.config.checkInterval / 1000} seconds`); console.log(`│ Check Interval: ${this.config.checkInterval / 1000} seconds`);
console.log('└──────────────────────────────────────────┘'); console.log('└────────────────────────────────────────────┘');
} }
/** /**
@ -228,7 +228,7 @@ export class NupstDaemon {
if (status.powerStatus !== lastStatus) { if (status.powerStatus !== lastStatus) {
console.log('┌─ Power Status Change ─────────────────────┐'); console.log('┌─ Power Status Change ─────────────────────┐');
console.log(`│ Status changed: ${lastStatus}${status.powerStatus}`); console.log(`│ Status changed: ${lastStatus}${status.powerStatus}`);
console.log('└──────────────────────────────────────────┘'); console.log('└──────────────────────────────────────────┘');
lastStatus = status.powerStatus; lastStatus = status.powerStatus;
lastLogTime = currentTime; // Reset log timer when status changes lastLogTime = currentTime; // Reset log timer when status changes
} }
@ -239,7 +239,7 @@ export class NupstDaemon {
console.log(`│ Timestamp: ${timestamp}`); console.log(`│ Timestamp: ${timestamp}`);
console.log(`│ Power Status: ${status.powerStatus}`); console.log(`│ Power Status: ${status.powerStatus}`);
console.log(`│ Battery: ${status.batteryCapacity}% | Runtime: ${status.batteryRuntime} min`); console.log(`│ Battery: ${status.batteryCapacity}% | Runtime: ${status.batteryRuntime} min`);
console.log('└──────────────────────────────────────────┘'); console.log('└──────────────────────────────────────────┘');
lastLogTime = currentTime; lastLogTime = currentTime;
} }
@ -267,7 +267,7 @@ export class NupstDaemon {
batteryCapacity: number, batteryCapacity: number,
batteryRuntime: number batteryRuntime: number
}): Promise<void> { }): Promise<void> {
console.log('┌─ UPS Status ────────────────────────────┐'); console.log('┌─ UPS Status ────────────────────────────┐');
console.log(`│ Battery: ${status.batteryCapacity}% | Runtime: ${status.batteryRuntime} min`); console.log(`│ Battery: ${status.batteryCapacity}% | Runtime: ${status.batteryRuntime} min`);
console.log('└──────────────────────────────────────────┘'); console.log('└──────────────────────────────────────────┘');