@@ -209,7 +209,8 @@ class messaget
209
209
210
210
mstreamt &operator << (const xmlt &data)
211
211
{
212
- *this << eom; // force end of previous message
212
+ if (this ->tellp () > 0 )
213
+ *this << eom; // force end of previous message
213
214
if (message.message_handler )
214
215
{
215
216
message.message_handler ->print (message_level, data);
@@ -219,7 +220,8 @@ class messaget
219
220
220
221
mstreamt &operator << (const json_objectt &data)
221
222
{
222
- *this << eom; // force end of previous message
223
+ if (this ->tellp () > 0 )
224
+ *this << eom; // force end of previous message
223
225
if (message.message_handler )
224
226
{
225
227
message.message_handler ->print (message_level, data);
@@ -243,7 +245,8 @@ class messaget
243
245
// / Returns a reference to the top-level JSON array stream
244
246
json_stream_arrayt &json_stream ()
245
247
{
246
- *this << eom; // force end of previous message
248
+ if (this ->tellp () > 0 )
249
+ *this << eom; // force end of previous message
247
250
return message.message_handler ->get_json_stream ();
248
251
}
249
252
@@ -264,9 +267,10 @@ class messaget
264
267
{
265
268
if (m.message .message_handler )
266
269
{
270
+ std::string msg = m.str ();
267
271
m.message .message_handler ->print (
268
272
m.message_level ,
269
- m. str () ,
273
+ msg ,
270
274
-1 ,
271
275
m.source_location );
272
276
m.message .message_handler ->flush (m.message_level );
0 commit comments