diff --git a/src/hakurei.cpp b/src/hakurei.cpp index b854df9..ebe13e8 100644 --- a/src/hakurei.cpp +++ b/src/hakurei.cpp @@ -20,6 +20,7 @@ #include +bool debug_mode = false; struct Entry { const std::string_view decoded_view; @@ -125,6 +126,7 @@ inline void print_debug_info(const std::vector& substrings, const s void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { + if (!debug_mode) return; std::ofstream log_file; log_file.open("/tmp/hakurei.log", std::ios_base::app); if (!log_file) { @@ -149,6 +151,12 @@ void log_execution(const int argc, char* argv[], const std::string& search_strin void log_internal(const std::string& message) { + extern bool debug_mode; // Declare the external debug_mode variable + + if (!debug_mode) { + return; + } + std::ofstream log_file; log_file.open("/tmp/hakurei.log", std::ios_base::app); if (!log_file) { @@ -160,7 +168,6 @@ void log_internal(const std::string& message) { log_file.close(); } - inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, @@ -234,7 +241,7 @@ int main(const int argc, char* argv[]) { log_internal("Trie loaded from dictionary file"); - bool debug_mode = false; + bool goldendict_mode = false; std::string word, sentence;