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

Log: Use object as context id for complex context

This commit is contained in:
winlin 2020-07-05 23:26:55 +08:00
parent bff7ef085d
commit 6624b8acca
34 changed files with 276 additions and 238 deletions

View file

@ -37,14 +37,14 @@
class SrsThreadContext : public ISrsContext
{
private:
std::map<srs_thread_t, std::string> cache;
std::map<srs_thread_t, SrsContextId> cache;
public:
SrsThreadContext();
virtual ~SrsThreadContext();
public:
virtual std::string generate_id();
virtual std::string get_id();
virtual std::string set_id(std::string v);
virtual SrsContextId generate_id();
virtual SrsContextId get_id();
virtual SrsContextId set_id(SrsContextId v);
public:
virtual void clear_cid();
};
@ -64,11 +64,11 @@ public:
public:
virtual srs_error_t initialize();
virtual void reopen();
virtual void verbose(const char* tag, const char* context_id, const char* fmt, ...);
virtual void info(const char* tag, const char* context_id, const char* fmt, ...);
virtual void trace(const char* tag, const char* context_id, const char* fmt, ...);
virtual void warn(const char* tag, const char* context_id, const char* fmt, ...);
virtual void error(const char* tag, const char* context_id, const char* fmt, ...);
virtual void verbose(const char* tag, SrsContextId context_id, const char* fmt, ...);
virtual void info(const char* tag, SrsContextId context_id, const char* fmt, ...);
virtual void trace(const char* tag, SrsContextId context_id, const char* fmt, ...);
virtual void warn(const char* tag, SrsContextId context_id, const char* fmt, ...);
virtual void error(const char* tag, SrsContextId context_id, const char* fmt, ...);
};
// Generate the log header.
@ -76,6 +76,6 @@ public:
// @param utc Whether use UTC time format in the log header.
// @param psize Output the actual header size.
// @remark It's a internal API.
bool srs_log_header(char* buffer, int size, bool utc, bool dangerous, const char* tag, const char* cid, const char* level, int* psize);
bool srs_log_header(char* buffer, int size, bool utc, bool dangerous, const char* tag, SrsContextId cid, const char* level, int* psize);
#endif