FluentLogger: fluent-logger-mbed A structured logger for Fluentd (mbed)

Dependents:   FluentLogger_Hello SNIC-FluentLogger-example

FluentLogger

Fluentd Logo

What is this ?

You can logging to Fluentd server.
This library included subset of MassagePack library.

Supported MessagePack formats(encode only)

format namefirst byte (in hex)
positive fixint0x00 - 0x7f
fixmap0x80 - 0x8f
fixarray0x90 - 0x9f
fixstr0xa0 - 0xbf
nil0xc0
false0xc2
true0xc3
float 320xca
float 640xcb
uint 80xcc
uint 160xcd
uint 320xce
uint 640xcf
int 80xd0
int 160xd1
int 320xd2
int 640xd3
str 80xd9
negative fixint0xe0 - 0xff

これは何?

Fluentd サーバにログを送信するためのライブラリです。
サブセット版のMassagePackライブラリも同梱しています。

サーバ側ダウン時の再接続機能は限定的に実装されています。 現時点での実装は送信時に切断を検知し、次回送信時に再接続する仕様です。

Revision:
1:6b1268731465
Parent:
0:b4815a079a4b
--- a/FluentLogger.cpp	Tue Nov 11 02:14:44 2014 +0000
+++ b/FluentLogger.cpp	Mon Dec 15 15:37:23 2014 +0000
@@ -61,7 +61,7 @@
     _mp->init();
 
     // tag, timestamp, message
-    if (!_mp->set_array(3)) {
+    if (!_mp->start_array(3)) {
         return -1;
     }
     if (!_mp->set_str(tag, strlen(tag))) {
@@ -84,7 +84,7 @@
 
 int FluentLogger::log(const char *tag, uMP &mpmsg)
 {
-    if (!_sock->is_connected()) {
+    if (_sock == NULL || !_sock->is_connected()) {
         if (open() < 0) {
             return -1;
         }
@@ -92,7 +92,7 @@
     _mp->init();
 
     // tag, timestamp, message
-    if (!_mp->set_array(3)) {
+    if (!_mp->start_array(3)) {
         return -1;
     }
     if (!_mp->set_str(tag, strlen(tag))) {