Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
64697039
提交
64697039
authored
4月 12, 2006
作者:
Brian West
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimize
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@1130
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
04ccb6ff
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
28 行增加
和
5 行删除
+28
-5
mod_console.c
src/mod/loggers/mod_console/mod_console.c
+28
-5
没有找到文件。
src/mod/loggers/mod_console/mod_console.c
浏览文件 @
64697039
...
...
@@ -32,6 +32,7 @@
#include <switch.h>
static
const
char
modname
[]
=
"mod_console"
;
static
const
uint8_t
STATIC_LEVELS
[]
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
};
static
switch_loadable_module_interface
console_module_interface
=
{
/*.module_name */
modname
,
...
...
@@ -48,8 +49,28 @@ static switch_loadable_module_interface console_module_interface = {
static
switch_memory_pool
*
module_pool
=
NULL
;
static
switch_hash
*
log_hash
=
NULL
;
static
switch_hash
*
name_hash
=
NULL
;
static
int8_t
all_level
=
-
1
;
static
void
del_mapping
(
char
*
var
)
{
if
(
!
strcasecmp
(
var
,
"all"
))
{
all_level
=
-
1
;
}
switch_core_hash_insert
(
log_hash
,
var
,
NULL
);
}
static
void
add_mapping
(
char
*
var
,
char
*
val
)
{
char
*
name
;
if
(
!
(
name
=
switch_core_hash_find
(
name_hash
,
var
)))
{
name
=
switch_core_strdup
(
module_pool
,
var
);
switch_core_hash_insert
(
name_hash
,
name
,
name
);
}
del_mapping
(
name
);
switch_core_hash_insert
(
log_hash
,
name
,
(
void
*
)
&
STATIC_LEVELS
[(
uint8_t
)
switch_log_str2level
(
val
)]);
}
static
switch_status
config_logger
(
void
)
{
switch_config
cfg
;
...
...
@@ -62,10 +83,11 @@ static switch_status config_logger(void)
}
switch_core_hash_init
(
&
log_hash
,
module_pool
);
switch_core_hash_init
(
&
name_hash
,
module_pool
);
while
(
switch_config_next_pair
(
&
cfg
,
&
var
,
&
val
))
{
if
(
!
strcasecmp
(
cfg
.
category
,
"mappings"
))
{
switch_core_hash_insert
(
log_hash
,
switch_core_strdup
(
module_pool
,
var
),
switch_core_strdup
(
module_pool
,
val
)
);
add_mapping
(
var
,
val
);
}
}
...
...
@@ -77,19 +99,20 @@ static switch_status switch_console_logger(const switch_log_node *node, switch_l
FILE
*
handle
;
if
((
handle
=
switch_core_data_channel
(
SWITCH_CHANNEL_ID_LOG
)))
{
char
*
lookup
=
NULL
;
uint8_t
*
lookup
=
NULL
;
switch_log_level
level
=
SWITCH_LOG_DEBUG
;
if
(
all_level
>
-
1
)
{
level
=
(
switch_log_level
)
all_level
;
}
else
if
(
log_hash
)
{
lookup
=
switch_core_hash_find
(
log_hash
,
node
->
file
);
if
(
!
lookup
)
{
lookup
=
switch_core_hash_find
(
log_hash
,
node
->
func
);
if
(
!
lookup
&&
all_level
==
-
1
)
{
if
((
lookup
=
switch_core_hash_find
(
log_hash
,
"all"
)))
{
all_level
=
(
int8_t
)
switch_log_str2level
(
lookup
)
;
all_level
=
*
lookup
;
}
else
{
all_level
=
-
2
;
}
...
...
@@ -99,7 +122,7 @@ static switch_status switch_console_logger(const switch_log_node *node, switch_l
}
if
(
lookup
)
{
level
=
switch_log_str2level
(
lookup
)
;
level
=
(
switch_log_level
)
*
lookup
;
}
if
(
!
log_hash
||
(((
all_level
>
-
1
)
||
lookup
)
&&
level
>=
node
->
level
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论