1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

CLS: Refine logging to global object.

This commit is contained in:
winlin 2022-08-27 12:28:33 +08:00
parent 8bc7342c3c
commit 6dc86b8a2e
3 changed files with 75 additions and 70 deletions

View file

@ -32,6 +32,7 @@ public:
virtual uint64_t nb_bytes();
srs_error_t encode(SrsBuffer* b);
public:
bool empty();
SrsClsSugar* kv(std::string k, std::string v);
SrsClsSugar* kvf(std::string k, const char* fmt, ...);
};
@ -69,30 +70,27 @@ private:
std::string endpoint_;
std::string topic_;
private:
SrsClsSugars* sugars_;
uint64_t nn_logs_;
public:
SrsClsClient();
virtual ~SrsClsClient();
public:
bool enabled();
bool stat_heartbeat();
bool stat_streams();
int heartbeat_ratio();
int streams_ratio();
std::string label();
std::string tag();
uint64_t nn_logs();
public:
srs_error_t initialize();
srs_error_t report();
private:
srs_error_t send_log(ISrsEncoder* sugar, int count, int total);
public:
srs_error_t do_send_logs(ISrsEncoder* sugar, int count, int total);
srs_error_t send_logs(SrsClsSugars* sugars);
srs_error_t dump_summaries(SrsClsSugars* sugars);
srs_error_t dump_streams(SrsClsSugars* sugars);
};
extern SrsClsClient* _srs_cls;
srs_error_t srs_cls_report();
#endif