riemann: Add batched event sending support

This makes the riemann destination respect `flush-lines()`, and send event in batches of configurable amount (defaults to 1). In case of an error, all messages within the batch will be retried, and eventually lost if retries do not succeed. Dropped messages, and messages that result in formatting errors do not count towards the batch size.

There is no timeout, but messages will be flushed upon deinit.

This fixes #284.

Requested-by: Fabien Wernli
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Maybe I'd factor out parts between `g_static_mutex_lock()` and `g_static_mutex_unlock()` into a function but it is OK for me.