| 15 | } |
| 16 | |
| 17 | void JSONencoder::flush() { |
| 18 | if (_linebuf.length()) { |
| 19 | if (_channel) { |
| 20 | if (_json_tag) { |
| 21 | // Output to channels is encapsulated in [MSG:JSON:...] |
| 22 | _channel->out_acked(_linebuf, "JSON:"); |
| 23 | } else { |
| 24 | log_stream(*_channel, _linebuf); |
| 25 | } |
| 26 | |
| 27 | } else { |
| 28 | _callback(_linebuf.c_str()); |
| 29 | } |
| 30 | _linebuf.clear(); |
| 31 | } |
| 32 | } |
| 33 | void JSONencoder::add(char c) { |
| 34 | _linebuf += c; |
| 35 | if (_channel && _linebuf.length() >= 100) { |