Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
4dae523b
提交
4dae523b
authored
10月 11, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tweak the session level logging to work on the console too
上级
a0049b22
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
29 行增加
和
4 行删除
+29
-4
switch_log.h
src/include/switch_log.h
+1
-0
switch_types.h
src/include/switch_types.h
+2
-1
mod_commands.c
src/mod/applications/mod_commands/mod_commands.c
+15
-1
mod_console.c
src/mod/loggers/mod_console/mod_console.c
+1
-1
switch_core_session.c
src/switch_core_session.c
+5
-0
switch_log.c
src/switch_log.c
+5
-1
没有找到文件。
src/include/switch_log.h
浏览文件 @
4dae523b
...
...
@@ -64,6 +64,7 @@ SWITCH_BEGIN_EXTERN_C
char
*
userdata
;
/* To maintain abi, only add new elements to the end of this struct and do not delete any elements */
switch_text_channel_t
channel
;
switch_log_level_t
slevel
;
}
switch_log_node_t
;
typedef
switch_status_t
(
*
switch_log_function_t
)
(
const
switch_log_node_t
*
node
,
switch_log_level_t
level
);
...
...
src/include/switch_types.h
浏览文件 @
4dae523b
...
...
@@ -1030,7 +1030,8 @@ typedef enum {
SWITCH_LOG_CRIT
=
2
,
SWITCH_LOG_ALERT
=
1
,
SWITCH_LOG_CONSOLE
=
0
,
SWITCH_LOG_INVALID
=
64
SWITCH_LOG_INVALID
=
64
,
SWITCH_LOG_UNINIT
=
1000
,
}
switch_log_level_t
;
...
...
src/mod/applications/mod_commands/mod_commands.c
浏览文件 @
4dae523b
...
...
@@ -5472,12 +5472,20 @@ SWITCH_STANDARD_API(escape_function)
#define UUID_LOGLEVEL_SYNTAX "<uuid> <level>"
SWITCH_STANDARD_API
(
uuid_loglevel
)
{
switch_core_session_t
*
tsession
=
NULL
;
switch_core_session_t
*
tsession
=
NULL
,
*
bsession
=
NULL
;
char
*
uuid
=
NULL
,
*
text
=
NULL
;
int
b
=
0
;
if
(
!
zstr
(
cmd
)
&&
(
uuid
=
strdup
(
cmd
)))
{
if
((
text
=
strchr
(
uuid
,
' '
)))
{
*
text
++
=
'\0'
;
if
(
!
strncasecmp
(
text
,
"-b"
,
2
))
{
b
++
;
if
((
text
=
strchr
(
text
,
' '
)))
{
*
text
++
=
'\0'
;
}
}
}
}
...
...
@@ -5491,6 +5499,12 @@ SWITCH_STANDARD_API(uuid_loglevel)
}
else
if
((
tsession
=
switch_core_session_locate
(
uuid
)))
{
switch_core_session_set_loglevel
(
tsession
,
level
);
if
(
b
&&
switch_core_session_get_partner
(
tsession
,
&
bsession
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_core_session_set_loglevel
(
bsession
,
level
);
switch_core_session_rwunlock
(
bsession
);
}
stream
->
write_function
(
stream
,
"+OK
\n
"
);
switch_core_session_rwunlock
(
tsession
);
}
else
{
...
...
src/mod/loggers/mod_console/mod_console.c
浏览文件 @
4dae523b
...
...
@@ -206,7 +206,7 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
}
#endif
if
(
level
>
hard_log_level
)
{
if
(
level
>
hard_log_level
&&
(
node
->
slevel
==
SWITCH_LOG_UNINIT
||
level
>
node
->
slevel
)
)
{
return
SWITCH_STATUS_SUCCESS
;
}
...
...
src/switch_core_session.c
浏览文件 @
4dae523b
...
...
@@ -531,6 +531,11 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
switch_assert
(
peer_channel
);
if
(
channel
&&
switch_true
(
switch_channel_get_variable
(
channel
,
"session_copy_loglevel"
)))
{
(
*
new_session
)
->
loglevel
=
session
->
loglevel
;
}
if
((
use_uuid
=
switch_event_get_header
(
var_event
,
"origination_uuid"
)))
{
use_uuid
=
switch_core_session_strdup
(
*
new_session
,
use_uuid
);
if
(
switch_core_session_set_uuid
(
*
new_session
,
use_uuid
)
==
SWITCH_STATUS_SUCCESS
)
{
...
...
src/switch_log.c
浏览文件 @
4dae523b
...
...
@@ -347,9 +347,11 @@ SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const cha
const
char
*
extra_fmt
=
"%s [%s] %s:%d%c%s"
;
#endif
switch_log_level_t
limit_level
=
runtime
.
hard_log_level
;
switch_log_level_t
special_level
=
SWITCH_LOG_UNINIT
;
if
(
channel
==
SWITCH_CHANNEL_ID_SESSION
&&
userdata
)
{
switch_core_session_t
*
session
=
(
switch_core_session_t
*
)
userdata
;
special_level
=
session
->
loglevel
;
if
(
limit_level
<
session
->
loglevel
)
{
limit_level
=
session
->
loglevel
;
}
...
...
@@ -478,11 +480,13 @@ SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const cha
switch_set_string
(
node
->
func
,
funcp
);
node
->
line
=
line
;
node
->
level
=
level
;
node
->
slevel
=
special_level
;
node
->
content
=
content
;
node
->
timestamp
=
now
;
node
->
channel
=
channel
;
if
(
channel
==
SWITCH_CHANNEL_ID_SESSION
)
{
node
->
userdata
=
userdata
?
strdup
(
switch_core_session_get_uuid
((
switch_core_session_t
*
)
userdata
))
:
NULL
;
switch_core_session_t
*
session
=
(
switch_core_session_t
*
)
userdata
;
node
->
userdata
=
userdata
?
strdup
(
switch_core_session_get_uuid
(
session
))
:
NULL
;
}
else
{
node
->
userdata
=
!
zstr
(
userdata
)
?
strdup
(
userdata
)
:
NULL
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论