Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-07-26 14:58:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9f2da4e095ffe12dbdfbd4607f99a13106b4fc24
9f2da4e0
1 parent
7241fa87
refine log, can be used when _srs_config is NULL.
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
19 行增加
和
19 行删除
trunk/src/app/srs_app_log.cpp
trunk/src/app/srs_app_log.hpp
trunk/src/utest/srs_utest.cpp
trunk/src/utest/srs_utest.hpp
trunk/src/app/srs_app_log.cpp
查看文件 @
9f2da4e
...
...
@@ -205,6 +205,10 @@ void SrsFastLog::error(const char* tag, int context_id, const char* fmt, ...)
int
SrsFastLog
::
on_reload_log_tank
()
{
int
ret
=
ERROR_SUCCESS
;
if
(
!
_srs_config
)
{
return
ret
;
}
bool
tank
=
log_to_file_tank
;
log_to_file_tank
=
_srs_config
->
get_log_tank_file
();
...
...
@@ -229,6 +233,10 @@ int SrsFastLog::on_reload_log_level()
{
int
ret
=
ERROR_SUCCESS
;
if
(
!
_srs_config
)
{
return
ret
;
}
_level
=
srs_get_log_level
(
_srs_config
->
get_log_level
());
return
ret
;
...
...
@@ -237,6 +245,10 @@ int SrsFastLog::on_reload_log_level()
int
SrsFastLog
::
on_reload_log_file
()
{
int
ret
=
ERROR_SUCCESS
;
if
(
!
_srs_config
)
{
return
ret
;
}
if
(
!
log_to_file_tank
)
{
return
ret
;
...
...
@@ -345,6 +357,10 @@ void SrsFastLog::write_log(int& fd, char *str_log, int size, int level)
void
SrsFastLog
::
open_log_file
()
{
if
(
!
_srs_config
)
{
return
;
}
std
::
string
filename
=
_srs_config
->
get_log_file
();
if
(
filename
.
empty
())
{
...
...
trunk/src/app/srs_app_log.hpp
查看文件 @
9f2da4e
...
...
@@ -57,6 +57,8 @@ public:
/**
* we use memory/disk cache and donot flush when write log.
* it's ok to use it without config, which will log to console, and default trace level.
* when you want to use different level, override this classs, set the protected _level.
*/
class
SrsFastLog
:
public
ISrsLog
,
public
ISrsReloadHandler
{
...
...
@@ -64,6 +66,7 @@ class SrsFastLog : public ISrsLog, public ISrsReloadHandler
protected:
// defined in SrsLogLevel.
int
_level
;
private
:
char
*
log_data
;
// log to file if specified srs_log_file
int
fd
;
...
...
trunk/src/utest/srs_utest.cpp
查看文件 @
9f2da4e
...
...
@@ -45,21 +45,6 @@ MockEmptyLog::~MockEmptyLog()
{
}
int
MockEmptyLog
::
on_reload_log_tank
()
{
return
ERROR_SUCCESS
;
}
int
MockEmptyLog
::
on_reload_log_level
()
{
return
ERROR_SUCCESS
;
}
int
MockEmptyLog
::
on_reload_log_file
()
{
return
ERROR_SUCCESS
;
}
void
__srs_bytes_print
(
char
*
pa
,
int
size
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
...
...
trunk/src/utest/srs_utest.hpp
查看文件 @
9f2da4e
...
...
@@ -61,10 +61,6 @@ private:
public
:
MockEmptyLog
(
int
level
);
virtual
~
MockEmptyLog
();
public
:
virtual
int
on_reload_log_tank
();
virtual
int
on_reload_log_level
();
virtual
int
on_reload_log_file
();
};
#endif
...
...
请
注册
或
登录
后发表评论