12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef LOG_SDK_LOG_PRODUCER_CLIENT_H
- #define LOG_SDK_LOG_PRODUCER_CLIENT_H
- #include "log_define.h"
- #include "log_producer_config.h"
- LOG_CPP_START
- /**
- * log producer client
- */
- typedef struct _log_producer_client
- {
- volatile int32_t valid_flag;
- int32_t log_level;
- void* private_data;
- }log_producer_client;
- /**
- * init log producer environment
- * @note should been called before create any log producer client
- * @note no multi thread safe
- * @return OK if success, others the error code
- */
- LOG_EXPORT log_producer_result log_producer_env_init();
- /**
- * destroy log producer environment
- * @note should been called after all log producer clients destroyed
- * @note no multi thread safe
- */
- LOG_EXPORT void log_producer_env_destroy();
- /**
- * create log producer client with a producer config
- * @param config log_producer_config
- * @param send_done_function this function will be called when send done(can be ok or fail), set to NULL if you don't care about it
- * @param user_param this param will send back in send_done_function
- * @return producer client ptr, NULL if create fail
- */
- LOG_EXPORT log_producer_client* create_log_producer_client(log_producer_config* config, on_log_producer_send_done_function send_done_function, void* user_param);
- /**
- * destroy log producer client
- * @param client
- * @note no multi thread safe
- */
- LOG_EXPORT void destroy_log_producer_client(log_producer_client* client);
- /**
- * add log天眼
- * @param client
- * @param log
- * @param flush
- * @return ok if success, LOG_PRODUCER_DROP_ERROR if buffer is full, LOG_PRODUCER_INVALID if client is destroyed, LOG_PRODUCER_PERSISTENT_ERROR is save binlog failed.
- */
- LOG_EXPORT log_producer_result log_producer_client_add_log(log_producer_client* client, log_item* log, int flush, long record_time);
- /**
- * add log天眼
- * */
- LOG_EXPORT log_producer_result log_producer_client_add_beidou_log(log_producer_client* client, beidou_log_item* log, int flush);
- LOG_EXPORT void log_producer_set_testLogMode();
- LOG_EXPORT int log_producer_sendTestLog_loki(const char* app, const char* env, const char* body);
- LOG_CPP_END
- #endif
|