Modify log monitor logging to be more generic

Includes other host services in addition to balena.service

Signed-off-by: Christina Ying Wang <christina@balena.io>
This commit is contained in:
Christina Ying Wang 2024-11-05 17:03:06 -08:00
parent 5ee5db2a04
commit e62e245fc7

View File

@ -81,7 +81,7 @@ class LogMonitor {
}
stderr?.on('data', (data) =>
log.error('journalctl - balena.service stderr: ', data.toString()),
log.error('Journalctl process stderr: ', data.toString()),
);
const self = this;
@ -102,9 +102,9 @@ class LogMonitor {
}
}
});
log.debug('balena.service journalctl process exit.');
log.debug('Journalctl process exit.');
} catch (e: any) {
log.error('journalctl - balena.service error: ', e.message ?? e);
log.error('Journalctl process error: ', e.message ?? e);
}
// On exit of process try to create another
@ -113,9 +113,7 @@ class LogMonitor {
JOURNALCTL_ERROR_RETRY_DELAY_MAX,
);
log.debug(
`Spawning another process to watch balena.service logs in ${
wait / 1000
}s`,
`Spawning another process to watch journal logs in ${wait / 1000}s`,
);
await setTimeout(wait);
void this.start();