Skip to content

Commit

Permalink
Settings: Support LIBOPENSHOT_DEBUG envvar
Browse files Browse the repository at this point in the history
- Setting LIBOPENSHOT_DEBUG to any value in the process environment
  activates debug logging to stderr.
  • Loading branch information
ferdnyc committed Apr 27, 2021
1 parent a00bbb7 commit 37f5e4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
9 changes: 6 additions & 3 deletions src/Settings.cpp
Expand Up @@ -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()
Expand All @@ -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;
Expand Down
14 changes: 1 addition & 13 deletions src/Settings.h
Expand Up @@ -31,19 +31,7 @@
#ifndef OPENSHOT_SETTINGS_H
#define OPENSHOT_SETTINGS_H


#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <sstream>
#include <cstdio>
#include <ctime>
#include <zmq.hpp>
#include <unistd.h>
#include <OpenShotAudio.h>


namespace openshot {

Expand Down Expand Up @@ -118,7 +106,7 @@ namespace openshot {
/// The current install path of OpenShot (needs to be set when using Timeline(path), since certain
/// paths depend on the location of OpenShot transitions and files)
std::string PATH_OPENSHOT_INSTALL = "";

/// Whether to dump ZeroMQ debug messages to stderr
bool DEBUG_TO_STDERR = false;

Expand Down

0 comments on commit 37f5e4d

Please sign in to comment.