LCOV - code coverage report
Current view: top level - datadog - cerr_logger.cpp (source / functions) Hit Total Coverage
Test: filtered.info Lines: 11 11 100.0 %
Date: 2024-01-03 20:30:12 Functions: 3 3 100.0 %

          Line data    Source code
       1             : #include "cerr_logger.h"
       2             : 
       3             : #include <iostream>
       4             : 
       5             : namespace datadog {
       6             : namespace tracing {
       7             : 
       8           3 : void CerrLogger::log_error(const LogFunc& write) { log(write); }
       9             : 
      10           1 : void CerrLogger::log_startup(const LogFunc& write) { log(write); }
      11             : 
      12           4 : void CerrLogger::log(const LogFunc& write) {
      13           4 :   std::lock_guard<std::mutex> lock(mutex_);
      14             : 
      15           4 :   stream_.clear();
      16             :   // Copy an empty string in, don't move it.
      17             :   // We want `stream_` to keep its storage.
      18           4 :   const std::string empty;
      19           4 :   stream_.str(empty);
      20             : 
      21           4 :   write(stream_);
      22           4 :   stream_ << '\n';
      23           4 :   std::cerr << stream_.str();
      24           4 : }
      25             : 
      26             : }  // namespace tracing
      27             : }  // namespace datadog

Generated by: LCOV version 1.16