chore(misc): normalize logs (#242)

This commit is contained in:
Jef LeCompte
2020-09-23 14:20:06 -04:00
committed by GitHub
parent 8466f9f398
commit 7c50e2b5aa
21 changed files with 239 additions and 183 deletions
+10 -10
View File
@@ -5,29 +5,29 @@ import playerLib from 'play-sound';
const notificationSound = Config.notifications.playSound;
Logger.info('Searching for sound player...');
Logger.info(' searching for sound player...');
const player = playerLib();
if (player.player === null) {
Logger.warn('No sound player found.');
} else {
const playerName: string = player.player;
Logger.info(`Sound player found: ${playerName}`);
Logger.info(`✔ sound player found: ${playerName}`);
}
export function playSound() {
// Check if file exists
fs.access(notificationSound, fs.constants.F_OK, err => {
if (err) {
Logger.error(`error opening sound file: ${err.message}`);
fs.access(notificationSound, fs.constants.F_OK, error => {
if (error) {
Logger.error(`error opening sound file: ${error.message}`);
return;
}
player.play(notificationSound, (err: string) => {
Logger.info('↗ playing sound');
if (err) {
Logger.error(`error playing sound: ${err}`);
player.play(notificationSound, (error: Error) => {
if (error) {
Logger.error('✖ couldn\'t play sound', error);
}
Logger.info('✔ played sound');
});
});
}