cpp: Add env var to control editinteractor debug
* lang/cpp/src/editinteractor.cpp (EditInteractor::Private::Private): Read "GPGMEPP_INTERACTOR_DEBUG" env var. (EditInteractor::Private::~Private): Close debug file. -- While it was possible for the application to control the debug through setDebugChannel it is often times helpful to just debug without changing the application using GPGME
This commit is contained in:
parent
1242c6c93a
commit
a4d5394b46
@ -178,10 +178,25 @@ EditInteractor::Private::Private(EditInteractor *qq)
|
|||||||
error(),
|
error(),
|
||||||
debug(nullptr)
|
debug(nullptr)
|
||||||
{
|
{
|
||||||
|
const char *debug_env = getenv("GPGMEPP_INTERACTOR_DEBUG");
|
||||||
|
if (!debug_env) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!strcmp(debug_env, "stdout")) {
|
||||||
|
debug = stdout;
|
||||||
|
} else if (!strcmp(debug_env, "stderr")) {
|
||||||
|
debug = stderr;
|
||||||
|
} else if (debug_env) {
|
||||||
|
debug = std::fopen(debug_env, "a+");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditInteractor::Private::~Private() {}
|
EditInteractor::Private::~Private()
|
||||||
|
{
|
||||||
|
if (debug) {
|
||||||
|
std::fclose(debug);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EditInteractor::EditInteractor()
|
EditInteractor::EditInteractor()
|
||||||
: d(new Private(this))
|
: d(new Private(this))
|
||||||
|
Loading…
Reference in New Issue
Block a user