| 94 | } |
| 95 | |
| 96 | void configure_logging(const LoggingConfig & config) { |
| 97 | std::lock_guard<std::mutex> lock(logger_mutex()); |
| 98 | auto & state = logger_state(); |
| 99 | logger_enabled_flag().store(false, std::memory_order_release); |
| 100 | if (state.file_path != config.file_path) { |
| 101 | state.file_stream.reset(); |
| 102 | } |
| 103 | state.file_path = config.file_path; |
| 104 | if (config.enabled && state.file_path.has_value() && !state.file_path->empty()) { |
| 105 | (void)logger_output_locked(state); |
| 106 | } |
| 107 | logger_enabled_flag().store(config.enabled, std::memory_order_release); |
| 108 | } |
| 109 | |
| 110 | void reset_logging() { |
| 111 | configure_logging(LoggingConfig{}); |