mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Log: Refine context
This commit is contained in:
parent
0a057a0427
commit
66aaad7805
4 changed files with 32 additions and 5 deletions
|
@ -77,6 +77,16 @@ void SrsThreadContext::clear_cid()
|
|||
}
|
||||
}
|
||||
|
||||
impl_SrsContextRestore::impl_SrsContextRestore(SrsContextId cid)
|
||||
{
|
||||
cid_ = cid;
|
||||
}
|
||||
|
||||
impl_SrsContextRestore::~impl_SrsContextRestore()
|
||||
{
|
||||
_srs_context->set_id(cid_);
|
||||
}
|
||||
|
||||
// LCOV_EXCL_START
|
||||
SrsConsoleLog::SrsConsoleLog(SrsLogLevel l, bool u)
|
||||
{
|
||||
|
|
|
@ -49,6 +49,20 @@ public:
|
|||
virtual void clear_cid();
|
||||
};
|
||||
|
||||
// The context restore stores the context and restore it when done.
|
||||
// Usage:
|
||||
// SrsContextRestore(_srs_context->get_id());
|
||||
#define SrsContextRestore(cid) \
|
||||
impl_SrsContextRestore _context_restore_instance(cid)
|
||||
class impl_SrsContextRestore
|
||||
{
|
||||
private:
|
||||
SrsContextId cid_;
|
||||
public:
|
||||
impl_SrsContextRestore(SrsContextId cid);
|
||||
virtual ~impl_SrsContextRestore();
|
||||
};
|
||||
|
||||
// The basic console log, which write log to console.
|
||||
class SrsConsoleLog : public ISrsLog
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue