| 24 | } |
| 25 | |
| 26 | void logger_impl::set_configuration(const std::shared_ptr<configuration>& _configuration) { |
| 27 | if (_configuration) { |
| 28 | // GCC < 10 hates member initializers in atomic structs |
| 29 | config cfg; // NOLINT(cppcoreguidelines-pro-type-member-init) |
| 30 | cfg.loglevel = _configuration->get_loglevel(); |
| 31 | cfg.console_enabled = _configuration->has_console_log(); |
| 32 | cfg.dlt_enabled = _configuration->has_dlt_log(); |
| 33 | { |
| 34 | std::scoped_lock its_lock{log_file_mutex_}; |
| 35 | cfg.file_enabled = _configuration->has_file_log(); |
| 36 | if (cfg.file_enabled) { |
| 37 | log_file_ = std::ofstream{_configuration->get_logfile(), std::ios_base::out | std::ios_base::app}; |
| 38 | } |
| 39 | } |
| 40 | config_.store(cfg, std::memory_order_release); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | void logger_impl::log_to_file(std::string_view _msg) { |
| 45 | std::scoped_lock its_lock{log_file_mutex_}; |
no test coverage detected