diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 18:45:34 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 18:45:34 +0200 |
commit | 2b3e02411ecc09e7d41741b5587655c9b2f955b7 (patch) | |
tree | d839746371ecb8ed64ac81d2e37c11fcd25a00ac /backend/genesys/error.cpp | |
parent | 787fb1d54ec9ee5fb941ae897fb201feb9cb2fd1 (diff) | |
parent | ad38bc6ecb80ddeb562841b33258dd53659b1da6 (diff) |
Update upstream source from tag 'upstream/1.0.31'
Update to upstream version '1.0.31'
with Debian dir aa7a39fe56343f5e164eec83783f4c923a394865
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 |