logger_impl.cxx 565 B

12345678910111213141516171819202122232425262728293031
  1. //
  2. // logger_impl.cxx
  3. // logging
  4. //
  5. // Created by Sam Jaffe on 4/3/19.
  6. //
  7. #include "logger_impl.h"
  8. #include "logger/detail/appender.h"
  9. #include "logger/detail/layout.h"
  10. using namespace logging;
  11. bool logger_impl::should_log(log_level ll) const {
  12. return ll >= min_log_level_;
  13. }
  14. void logger_impl::write(logpacket const & pkt) {
  15. for (auto & pair : impls_) {
  16. if (pair.first->should_log(pkt.level)) {
  17. pair.first->write(pair.second->format(pkt));
  18. }
  19. }
  20. }
  21. void logger_impl::flush() {
  22. for (auto & pair : impls_) {
  23. pair.first->flush();
  24. }
  25. }