fix(cli): Improve console output formatting for status banners and logging messages
This commit is contained in:
12
ts/daemon.ts
12
ts/daemon.ts
@@ -226,8 +226,8 @@ export class NupstDaemon {
|
||||
|
||||
// Log status changes
|
||||
if (status.powerStatus !== lastStatus) {
|
||||
console.log('┌──────────────────────────────────────────┐');
|
||||
console.log(`│ Power status changed: ${lastStatus} → ${status.powerStatus}`);
|
||||
console.log('┌─ Power Status Change ─────────────────────┐');
|
||||
console.log(`│ Status changed: ${lastStatus} → ${status.powerStatus}`);
|
||||
console.log('└──────────────────────────────────────────┘');
|
||||
lastStatus = status.powerStatus;
|
||||
lastLogTime = currentTime; // Reset log timer when status changes
|
||||
@@ -235,8 +235,8 @@ export class NupstDaemon {
|
||||
// Log status periodically (at least every 5 minutes)
|
||||
else if (shouldLogStatus) {
|
||||
const timestamp = new Date().toISOString();
|
||||
console.log('┌──────────────────────────────────────────┐');
|
||||
console.log(`│ [${timestamp}] Periodic Status Update`);
|
||||
console.log('┌─ Periodic Status Update ──────────────────┐');
|
||||
console.log(`│ Timestamp: ${timestamp}`);
|
||||
console.log(`│ Power Status: ${status.powerStatus}`);
|
||||
console.log(`│ Battery: ${status.batteryCapacity}% | Runtime: ${status.batteryRuntime} min`);
|
||||
console.log('└──────────────────────────────────────────┘');
|
||||
@@ -267,8 +267,8 @@ export class NupstDaemon {
|
||||
batteryCapacity: number,
|
||||
batteryRuntime: number
|
||||
}): Promise<void> {
|
||||
console.log('┌─ UPS Status ───────────────────────────────┐');
|
||||
console.log(`│ Battery: ${status.batteryCapacity}% | Runtime: ${status.batteryRuntime} min │`);
|
||||
console.log('┌─ UPS Status ────────────────────────────┐');
|
||||
console.log(`│ Battery: ${status.batteryCapacity}% | Runtime: ${status.batteryRuntime} min`);
|
||||
console.log('└──────────────────────────────────────────┘');
|
||||
|
||||
// Check battery threshold
|
||||
|
Reference in New Issue
Block a user