Because of excessive messages being written to the screen, I set the logging to write to the ~/.config/naomi/Naomi.log file by default. The problem with that is that critical error messages would not get written to the screen.
Here I have set logging to log to a log file if one is explicitly set in the profile.yml file, but also to write ERROR and CRITICAL level messages to the screen. If running in DEBUG mode with a log file, then DEBUG, INFO and WARN messages are written to the log file and only ERROR or CRITICAL messages appear on the screen.
We might want to think about having Naomi attempt to also speak ERROR and CRITICAL level messages.
I also removed the redirect of stderr to /dev/null that surrounded calls to opening pyAudio output streams, which was causing buffer underflow error messages to write to the screen. The constant stream redirects were causing "Too many open files" errors, which eventually cause Naomi to crash.
Description
Because of excessive messages being written to the screen, I set the logging to write to the ~/.config/naomi/Naomi.log file by default. The problem with that is that critical error messages would not get written to the screen.
Here I have set logging to log to a log file if one is explicitly set in the profile.yml file, but also to write ERROR and CRITICAL level messages to the screen. If running in DEBUG mode with a log file, then DEBUG, INFO and WARN messages are written to the log file and only ERROR or CRITICAL messages appear on the screen.
We might want to think about having Naomi attempt to also speak ERROR and CRITICAL level messages.
I also removed the redirect of stderr to /dev/null that surrounded calls to opening pyAudio output streams, which was causing buffer underflow error messages to write to the screen. The constant stream redirects were causing "Too many open files" errors, which eventually cause Naomi to crash.
Related Issue
Critical and Error level log messages not written to the screen #397
Motivation and Context
This just improves the error logging system
How Has This Been Tested?
Types of changes
Checklist: