No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

32 líneas
781 B

  1. #include <cstring>
  2. #include <iomanip>
  3. #include <cpplogging/manager/manager.h>
  4. #include <cpplogging/manager/consumer/consumer_stream.h>
  5. using namespace ::cpplogging;
  6. consumer_stream::consumer_stream(
  7. const std::string& name,
  8. std::ostream& stream,
  9. const std::string& format)
  10. : consumer (name, format)
  11. , _stream (stream)
  12. , _storage (nullptr)
  13. { }
  14. consumer_stream::consumer_stream(
  15. const std::string& name,
  16. stream_ptr_u&& stream,
  17. const std::string& format)
  18. : consumer (name, format)
  19. , _stream (*stream)
  20. , _storage (std::move(stream))
  21. { }
  22. void consumer_stream::write_entry(const log_entry_ptr_s& entry) const
  23. {
  24. std::lock_guard<std::mutex> lk(_mutex);
  25. write_formatted(*entry, _format, _stream);
  26. }