Skip to content

Commit

Permalink
Fall back to default constructed logger with existing appenders if no…
Browse files Browse the repository at this point in the history
… 'default' logger.
  • Loading branch information
heifner committed Aug 22, 2019
1 parent 2aa371a commit 2490a4b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/log/logger_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,17 @@ namespace fc {
if( log_config::get().logger_map.find( name ) != log_config::get().logger_map.end() ) {
log = log_config::get().logger_map[name];
} else {
// no entry for logger, so setup with default logger
log = log_config::get().logger_map[ DEFAULT_LOGGER ];
log_config::get().logger_map.emplace( name, log );
// no entry for logger, so setup with default logger if it exists, otherwise default construct and use registered appenders
if( log_config::get().logger_map.find( DEFAULT_LOGGER ) != log_config::get().logger_map.end() ) {
log = log_config::get().logger_map[DEFAULT_LOGGER];
log_config::get().logger_map.emplace( name, log );
} else {
log = logger(name);
for( const auto& a : log_config::get().appender_map ) {
log.add_appender( a.second );
}
log_config::get().logger_map.emplace( name, log );
}
}
}

Expand Down

0 comments on commit 2490a4b

Please sign in to comment.