mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
support reload log level/logfile/tank
This commit is contained in:
parent
f652c28485
commit
eda1ddc03d
8 changed files with 149 additions and 43 deletions
|
@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <srs_app_st.hpp>
|
||||
#include <srs_kernel_log.hpp>
|
||||
#include <srs_app_reload.hpp>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -57,7 +58,7 @@ public:
|
|||
/**
|
||||
* we use memory/disk cache and donot flush when write log.
|
||||
*/
|
||||
class SrsFastLog : public ISrsLog
|
||||
class SrsFastLog : public ISrsLog, public ISrsReloadHandler
|
||||
{
|
||||
private:
|
||||
// defined in SrsLogLevel.
|
||||
|
@ -65,21 +66,27 @@ private:
|
|||
char* log_data;
|
||||
// log to file if specified srs_log_file
|
||||
int fd;
|
||||
// whether log to file tank
|
||||
bool log_to_file_tank;
|
||||
public:
|
||||
SrsFastLog();
|
||||
virtual ~SrsFastLog();
|
||||
public:
|
||||
virtual int initialize();
|
||||
virtual int level();
|
||||
virtual void set_level(int level);
|
||||
virtual void verbose(const char* tag, int context_id, const char* fmt, ...);
|
||||
virtual void info(const char* tag, int context_id, const char* fmt, ...);
|
||||
virtual void trace(const char* tag, int context_id, const char* fmt, ...);
|
||||
virtual void warn(const char* tag, int context_id, const char* fmt, ...);
|
||||
virtual void error(const char* tag, int context_id, const char* fmt, ...);
|
||||
// interface ISrsThreadHandler.
|
||||
public:
|
||||
virtual int on_reload_log_tank();
|
||||
virtual int on_reload_log_level();
|
||||
virtual int on_reload_log_file();
|
||||
private:
|
||||
virtual bool generate_header(const char* tag, int context_id, const char* level_name, int* header_size);
|
||||
static void write_log(int& fd, char* str_log, int size, int level);
|
||||
virtual void write_log(int& fd, char* str_log, int size, int level);
|
||||
virtual void open_log_file();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue