Add ability to set libpbd debug options via PBD_DEBUG environment var

This commit is contained in:
Tim Mayberry 2014-12-02 20:36:14 +07:00
parent 9eb8b73b43
commit d360bc3906

View File

@ -19,6 +19,7 @@
#include <iostream>
#include <cstdlib>
#include <string>
#ifdef PLATFORM_WINDOWS
#include <fcntl.h>
@ -43,6 +44,19 @@ static bool libpbd_initialized = false;
}
void
set_debug_options_from_env ()
{
bool set;
std::string options;
options = Glib::getenv ("PBD_DEBUG", set);
if (set) {
std::cerr << "PBD_DEBUG=" << options << std::endl;
PBD::parse_debug_options (options.c_str());
}
}
bool
PBD::init ()
{
@ -66,6 +80,8 @@ PBD::init ()
setup_libpbd_enums ();
set_debug_options_from_env ();
libpbd_initialized = true;
return true;
}