Settings: Support LIBOPENSHOT_DEBUG envvar

- Setting LIBOPENSHOT_DEBUG to any value in the process environment
  activates debug logging to stderr.
This commit is contained in:
FeRD (Frank Dana)
2021-04-27 16:19:31 -04:00
parent a00bbb7698
commit 37f5e4dfbf
2 changed files with 7 additions and 16 deletions

View File

@@ -28,14 +28,14 @@
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdlib> // For std::getenv
#include "Settings.h"
using namespace std;
using namespace openshot;
// Global reference to Settings
Settings *Settings::m_pInstance = NULL;
Settings *Settings::m_pInstance = nullptr;
// Create or Get an instance of the settings singleton
Settings *Settings::Instance()
@@ -53,6 +53,9 @@ Settings *Settings::Instance()
m_pInstance->HW_EN_DEVICE_SET = 0;
m_pInstance->PLAYBACK_AUDIO_DEVICE_NAME = "";
m_pInstance->DEBUG_TO_STDERR = false;
auto env_debug = std::getenv("LIBOPENSHOT_DEBUG");
if (env_debug != nullptr)
m_pInstance->DEBUG_TO_STDERR = true;
}
return m_pInstance;