MCPcopy Create free account
hub / github.com/COVESA/vsomeip / set_configuration

Method set_configuration

implementation/logger/src/logger_impl.cpp:26–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26void 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
44void logger_impl::log_to_file(std::string_view _msg) {
45 std::scoped_lock its_lock{log_file_mutex_};

Callers 1

initMethod · 0.80

Calls 4

get_loglevelMethod · 0.80
has_console_logMethod · 0.80
has_dlt_logMethod · 0.80
has_file_logMethod · 0.80

Tested by

no test coverage detected