MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / set_log_file_data_handler

Function set_log_file_data_handler

src/data_handler/data_handler.cpp:75–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75int set_log_file_data_handler (const char *log_file)
76{
77 std::lock_guard<std::mutex> lock (data_mutex);
78#ifdef __ANDROID__
79 data_logger->error ("For Android set_log_file is unavailable");
80 return (int)BrainFlowExitCodes::GENERAL_ERROR;
81#else
82 try
83 {
84 spdlog::level::level_enum level = data_logger->level ();
85 data_logger = spdlog::create<spdlog::sinks::null_sink_st> (
86 "null_logger"); // to not set logger to nullptr and avoid race condition
87 spdlog::drop (LOGGER_NAME);
88 data_logger = spdlog::basic_logger_mt (LOGGER_NAME, log_file);
89 data_logger->set_level (level);
90 data_logger->flush_on (level);
91 spdlog::drop ("null_logger");
92 }
93 catch (...)
94 {
95 return (int)BrainFlowExitCodes::GENERAL_ERROR;
96 }
97 return (int)BrainFlowExitCodes::STATUS_OK;
98#endif
99}
100
101int set_log_level_data_handler (int level)
102{

Callers 2

set_log_fileMethod · 0.85
set_log_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected