only show log if in debug mode
This commit is contained in:
parent
34fb696599
commit
a7cadd0036
|
@ -20,6 +20,7 @@
|
|||
#include <ctime>
|
||||
|
||||
|
||||
bool debug_mode = false;
|
||||
|
||||
struct Entry {
|
||||
const std::string_view decoded_view;
|
||||
|
@ -125,6 +126,7 @@ inline void print_debug_info(const std::vector<std::string>& 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<std::string>& substrings,
|
||||
const std::map<std::string, std::set<std::string>>& 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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue