mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #820, extract service module.
This commit is contained in:
parent
0a57a46016
commit
ff822b55cd
16 changed files with 510 additions and 213 deletions
|
@ -26,33 +26,11 @@
|
|||
|
||||
#include <srs_core.hpp>
|
||||
|
||||
#include <srs_app_st.hpp>
|
||||
#include <srs_kernel_log.hpp>
|
||||
#include <srs_app_reload.hpp>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
/**
|
||||
* st thread context, get_id will get the st-thread id,
|
||||
* which identify the client.
|
||||
*/
|
||||
class SrsThreadContext : public ISrsThreadContext
|
||||
{
|
||||
private:
|
||||
std::map<st_thread_t, int> cache;
|
||||
public:
|
||||
SrsThreadContext();
|
||||
virtual ~SrsThreadContext();
|
||||
public:
|
||||
virtual int generate_id();
|
||||
virtual int get_id();
|
||||
virtual int set_id(int v);
|
||||
public:
|
||||
virtual void clear_cid();
|
||||
};
|
||||
#include <srs_app_reload.hpp>
|
||||
#include <srs_service_log.hpp>
|
||||
|
||||
/**
|
||||
* we use memory/disk cache and donot flush when write log.
|
||||
|
@ -61,10 +39,10 @@ public:
|
|||
*/
|
||||
class SrsFastLog : public ISrsLog, public ISrsReloadHandler
|
||||
{
|
||||
// for utest to override
|
||||
// for utest to override
|
||||
protected:
|
||||
// defined in SrsLogLevel.
|
||||
int _level;
|
||||
SrsLogLevel level;
|
||||
private:
|
||||
char* log_data;
|
||||
// log to file if specified srs_log_file
|
||||
|
@ -76,6 +54,7 @@ private:
|
|||
public:
|
||||
SrsFastLog();
|
||||
virtual ~SrsFastLog();
|
||||
// interface ISrsLog
|
||||
public:
|
||||
virtual int initialize();
|
||||
virtual void reopen();
|
||||
|
@ -91,7 +70,6 @@ public:
|
|||
virtual int on_reload_log_level();
|
||||
virtual int on_reload_log_file();
|
||||
private:
|
||||
virtual bool generate_header(bool error, const char* tag, int context_id, const char* level_name, int* header_size);
|
||||
virtual void write_log(int& fd, char* str_log, int size, int level);
|
||||
virtual void open_log_file();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue