FluentLogger: fluent-logger-mbed A structured logger for Fluentd (mbed)
Dependents: FluentLogger_Hello SNIC-FluentLogger-example
FluentLogger
What is this ?
You can logging to Fluentd server.
This library included subset of MassagePack library.
Supported MessagePack formats(encode only)
format name | first byte (in hex) |
---|---|
positive fixint | 0x00 - 0x7f |
fixmap | 0x80 - 0x8f |
fixarray | 0x90 - 0x9f |
fixstr | 0xa0 - 0xbf |
nil | 0xc0 |
false | 0xc2 |
true | 0xc3 |
float 32 | 0xca |
float 64 | 0xcb |
uint 8 | 0xcc |
uint 16 | 0xcd |
uint 32 | 0xce |
uint 64 | 0xcf |
int 8 | 0xd0 |
int 16 | 0xd1 |
int 32 | 0xd2 |
int 64 | 0xd3 |
str 8 | 0xd9 |
negative fixint | 0xe0 - 0xff |
これは何?
Fluentd サーバにログを送信するためのライブラリです。
サブセット版のMassagePackライブラリも同梱しています。
サーバ側ダウン時の再接続機能は限定的に実装されています。 現時点での実装は送信時に切断を検知し、次回送信時に再接続する仕様です。
Diff: uMP.h
- Revision:
- 1:6b1268731465
- Parent:
- 0:b4815a079a4b
--- a/uMP.h Tue Nov 11 02:14:44 2014 +0000 +++ b/uMP.h Mon Dec 15 15:37:23 2014 +0000 @@ -19,6 +19,7 @@ #include <stdint.h> #include <string.h> +#include <string> /** Subset of MessagePack implementation. * @@ -57,7 +58,7 @@ * @retval true Success * @retval false Failure */ - bool set_array(uint32_t size); + bool start_array(uint32_t size); /** Start map format * @@ -65,7 +66,7 @@ * @retval true Success * @retval false Failure */ - bool set_map(uint32_t size); + bool start_map(uint32_t size); /** Set NIL message * @@ -199,6 +200,16 @@ */ bool set_str(const char *data, uint32_t size); + /** Set string message + * + * Auto route the optimal function. + * + * @param str string of message string + * @retval true Success + * @retval false Failure + */ + bool set_str(const std::string& str); + /** Set string message (upto 31 bytes) * * @param data Pointer of message string @@ -229,6 +240,105 @@ */ bool set_raw(const char *data, uint8_t size); + /** associate a key with value (bool) + * + * @param k key string + * @param v bool value(true/false) + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, bool v); + + /** associate a key with value (uint8_t) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, uint8_t v); + + /** associate a key with value (uint16_t) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, uint16_t v); + + /** associate a key with value (uint32_t) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, uint32_t v); + + /** associate a key with value (int8_t) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, int8_t v); + + /** associate a key with value (int16_t) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, int16_t v); + + /** associate a key with value (int32_t) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, int32_t v); + + /** associate a key with value (float) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, float v); + + /** associate a key with value (double) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, double v); + + /** associate a key with value (char * string) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, const char *v); + + /** associate a key with value (string) + * + * @param k key string + * @param v value + * @retval true Success + * @retval false Failure + */ + bool map(const std::string& k, const std::string& v); + private: enum MpTag{ TAG_POSITIVE_FIXNUM = 0x00,