Sam Jaffe vor 6 Jahren
Ursprung
Commit
9cc564c08c
3 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 1 1
      include/logger/logger_fwd.h
  2. 2 2
      src/c_logger.cxx
  3. 1 1
      src/logger.cxx

+ 1 - 1
include/logger/logger_fwd.h

@@ -32,7 +32,7 @@ namespace logging {
     //    int thread_id;
     log_level level;
     location_info info;
-    const char* logger;
+    std::string logger;
     std::string message;
   };
 }

+ 2 - 2
src/c_logger.cxx

@@ -29,13 +29,13 @@ void c_logger::vlognf(log_level level, size_t num_bytes, char const* fmt,
   int n = vsnprintf(data.get(), num_bytes, fmt, args);
   if (n >= 0) {
     data[num_bytes-1] = '\0';
-    impl_->write({ now(), level, {}, logger_name_.c_str(), data.get() });
+    impl_->write({ now(), level, {}, logger_name_, data.get() });
   }
 }
 
 void c_logger::log(log_level level, std::string const& msg) {
   if (level < min_level_ || !impl_->should_log(level)) return;
-  impl_->write({ now(), level, {}, logger_name_.c_str(), msg });
+  impl_->write({ now(), level, {}, logger_name_, msg });
 }
 
 void c_logger::flush() {

+ 1 - 1
src/logger.cxx

@@ -31,7 +31,7 @@ namespace logging {
   
   void logger::log(log_level ll, location_info info,
                    std::string const & msg) {
-    impl_->write({ now(), ll, info, logger_name_.c_str(), msg });
+    impl_->write({ now(), ll, info, logger_name_, msg });
   }
   
   bool logger::should_log(log_level ll) const {