diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-09-10 19:11:27 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-09-10 19:11:27 +0200 |
commit | 7e9455b3b15671ff99ed168638c405e2acedb6df (patch) | |
tree | 444e59ece236e09dc153f665e42160aeb0208c24 /backend/genesys/error.cpp | |
parent | bc8a517abd2e11e1435f4ef042cfcc8648b62ef7 (diff) | |
parent | bce41b3c37c2a68e7dab234ce0247755a61ceb40 (diff) |
Merge branch 'release/debian/1.0.31-1_experimental1' into masterdebian/1.0.31-1_experimental1
Diffstat (limited to 'backend/genesys/error.cpp')
-rw-r--r-- | backend/genesys/error.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/backend/genesys/error.cpp b/backend/genesys/error.cpp index 6c921c1..46d79c9 100644 --- a/backend/genesys/error.cpp +++ b/backend/genesys/error.cpp @@ -45,6 +45,7 @@ #include "error.h" #include <cstdarg> +#include <cstdlib> namespace genesys { @@ -212,4 +213,32 @@ void DebugMessageHelper::vlog(unsigned level, const char* format, ...) DBG(level, "%s: %s\n", func_, msg.c_str()); } +enum class LogImageDataStatus +{ + NOT_SET, + ENABLED, + DISABLED +}; + +static LogImageDataStatus s_log_image_data_setting = LogImageDataStatus::NOT_SET; + +LogImageDataStatus dbg_read_log_image_data_setting() +{ + auto* setting = std::getenv("SANE_DEBUG_GENESYS_IMAGE"); + if (!setting) + return LogImageDataStatus::DISABLED; + auto setting_int = std::strtol(setting, nullptr, 10); + if (setting_int == 0) + return LogImageDataStatus::DISABLED; + return LogImageDataStatus::ENABLED; +} + +bool dbg_log_image_data() +{ + if (s_log_image_data_setting == LogImageDataStatus::NOT_SET) { + s_log_image_data_setting = dbg_read_log_image_data_setting(); + } + return s_log_image_data_setting == LogImageDataStatus::ENABLED; +} + } // namespace genesys |