From 778ac40e8160069ad8c055bd93da007a1abde5d1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 4 Dec 2008 13:01:19 -0800 Subject: [PATCH] logclient: optionally take a stringstream --- src/common/LogClient.cc | 11 ++++++++++- src/common/LogClient.h | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/common/LogClient.cc b/src/common/LogClient.cc index f4f043b18db78..ee5d0bf18002c 100644 --- a/src/common/LogClient.cc +++ b/src/common/LogClient.cc @@ -35,7 +35,16 @@ #include "config.h" -void LogClient::log(log_type type, string s) +void LogClient::log(log_type type, stringstream& ss) +{ + while (!ss.eof()) { + string s; + getline(ss, s); + log(type, s); + } +} + +void LogClient::log(log_type type, string& s) { Mutex::Locker l(log_lock); dout(10) << "log " << (log_type)type << " : " << s << dendl; diff --git a/src/common/LogClient.h b/src/common/LogClient.h index 084ec5eae9d21..d5f49147b6b7e 100644 --- a/src/common/LogClient.h +++ b/src/common/LogClient.h @@ -20,6 +20,8 @@ #include "common/Mutex.h" #include "include/LogEntry.h" +#include + class Messenger; class MLog; class MonMap; @@ -35,7 +37,8 @@ class LogClient { deque log_queue; version_t last_log; - void log(log_type type, string s); + void log(log_type type, string& s); + void log(log_type type, stringstream& s); void send_log(); void handle_log(MLog *m); -- 2.39.5