Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
2fd21a47
提交
2fd21a47
authored
7月 07, 2013
作者:
Ken Rice
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-2816 --resolve
上级
84de992b
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
38 行增加
和
5 行删除
+38
-5
fs_cli.c
libs/esl/fs_cli.c
+24
-4
mod_console.c
src/mod/loggers/mod_console/mod_console.c
+14
-1
没有找到文件。
libs/esl/fs_cli.c
浏览文件 @
2fd21a47
...
@@ -57,6 +57,7 @@ typedef struct {
...
@@ -57,6 +57,7 @@ typedef struct {
int
debug
;
int
debug
;
const
char
*
console_fnkeys
[
12
];
const
char
*
console_fnkeys
[
12
];
char
loglevel
[
128
];
char
loglevel
[
128
];
int
log_uuid
;
int
quiet
;
int
quiet
;
int
batch_mode
;
int
batch_mode
;
char
prompt_color
[
12
];
char
prompt_color
[
12
];
...
@@ -595,6 +596,7 @@ static const char *usage_str =
...
@@ -595,6 +596,7 @@ static const char *usage_str =
" -i, --interrupt Allow Control-c to interrupt
\n
"
" -i, --interrupt Allow Control-c to interrupt
\n
"
" -x, --execute=command Execute Command and Exit
\n
"
" -x, --execute=command Execute Command and Exit
\n
"
" -l, --loglevel=command Log Level
\n
"
" -l, --loglevel=command Log Level
\n
"
" -U, --log-uuid Include UUID in log output
\n
"
" -q, --quiet Disable logging
\n
"
" -q, --quiet Disable logging
\n
"
" -r, --retry Retry connection on failure
\n
"
" -r, --retry Retry connection on failure
\n
"
" -R, --reconnect Reconnect if disconnected
\n
"
" -R, --reconnect Reconnect if disconnected
\n
"
...
@@ -745,10 +747,14 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
...
@@ -745,10 +747,14 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
if
(
aok
)
{
if
(
aok
)
{
if
(
feature_level
)
clear_line
();
if
(
feature_level
)
clear_line
();
if
(
!
(
global_profile
->
batch_mode
))
{
if
(
!
(
global_profile
->
batch_mode
))
{
printf
(
"%s%s"
,
colors
[
level
],
handle
->
last_event
->
body
);
printf
(
"%s"
,
colors
[
level
]);
}
if
(
global_profile
->
log_uuid
&&
!
esl_strlen_zero
(
userdata
))
{
printf
(
"%s "
,
userdata
);
}
printf
(
"%s"
,
handle
->
last_event
->
body
);
if
(
!
(
global_profile
->
batch_mode
))
{
if
(
!
feature_level
)
printf
(
"%s"
,
ESL_SEQ_DEFAULT_COLOR
);
if
(
!
feature_level
)
printf
(
"%s"
,
ESL_SEQ_DEFAULT_COLOR
);
}
else
{
printf
(
"%s"
,
handle
->
last_event
->
body
);
}
}
if
(
feature_level
)
redisplay
();
if
(
feature_level
)
redisplay
();
}
}
...
@@ -757,6 +763,10 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
...
@@ -757,6 +763,10 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
if
(
!
(
global_profile
->
batch_mode
))
{
if
(
!
(
global_profile
->
batch_mode
))
{
SetConsoleTextAttribute
(
hStdout
,
colors
[
level
]);
SetConsoleTextAttribute
(
hStdout
,
colors
[
level
]);
}
}
if
(
global_profile
->
log_uuid
&&
!
esl_strlen_zero
(
userdata
))
{
WriteFile
(
hStdout
,
userdata
,
strlen
(
userdata
),
&
outbytes
,
NULL
);
WriteFile
(
hStdout
,
" "
,
strlen
(
" "
),
&
outbytes
,
NULL
);
}
WriteFile
(
hStdout
,
handle
->
last_event
->
body
,
len
,
&
outbytes
,
NULL
);
WriteFile
(
hStdout
,
handle
->
last_event
->
body
,
len
,
&
outbytes
,
NULL
);
if
(
!
(
global_profile
->
batch_mode
))
{
if
(
!
(
global_profile
->
batch_mode
))
{
SetConsoleTextAttribute
(
hStdout
,
wOldColorAttrs
);
SetConsoleTextAttribute
(
hStdout
,
wOldColorAttrs
);
...
@@ -1221,6 +1231,8 @@ static void read_config(const char *dft_cfile, const char *cfile) {
...
@@ -1221,6 +1231,8 @@ static void read_config(const char *dft_cfile, const char *cfile) {
}
}
}
else
if
(
!
strcasecmp
(
var
,
"loglevel"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"loglevel"
))
{
esl_set_string
(
profiles
[
pcount
-
1
].
loglevel
,
val
);
esl_set_string
(
profiles
[
pcount
-
1
].
loglevel
,
val
);
}
else
if
(
!
strcasecmp
(
var
,
"log-uuid"
))
{
profiles
[
pcount
-
1
].
log_uuid
=
esl_true
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"quiet"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"quiet"
))
{
profiles
[
pcount
-
1
].
quiet
=
esl_true
(
val
);
profiles
[
pcount
-
1
].
quiet
=
esl_true
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"prompt-color"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"prompt-color"
))
{
...
@@ -1282,6 +1294,7 @@ int main(int argc, char *argv[])
...
@@ -1282,6 +1294,7 @@ int main(int argc, char *argv[])
{
"debug"
,
1
,
0
,
'd'
},
{
"debug"
,
1
,
0
,
'd'
},
{
"execute"
,
1
,
0
,
'x'
},
{
"execute"
,
1
,
0
,
'x'
},
{
"loglevel"
,
1
,
0
,
'l'
},
{
"loglevel"
,
1
,
0
,
'l'
},
{
"log-uuid"
,
0
,
0
,
'U'
},
{
"quiet"
,
0
,
0
,
'q'
},
{
"quiet"
,
0
,
0
,
'q'
},
{
"batchmode"
,
0
,
0
,
'b'
},
{
"batchmode"
,
0
,
0
,
'b'
},
{
"retry"
,
0
,
0
,
'r'
},
{
"retry"
,
0
,
0
,
'r'
},
...
@@ -1303,6 +1316,7 @@ int main(int argc, char *argv[])
...
@@ -1303,6 +1316,7 @@ int main(int argc, char *argv[])
int
argv_exec
=
0
;
int
argv_exec
=
0
;
char
argv_command
[
1024
]
=
""
;
char
argv_command
[
1024
]
=
""
;
char
argv_loglevel
[
128
]
=
""
;
char
argv_loglevel
[
128
]
=
""
;
int
argv_log_uuid
=
0
;
int
argv_quiet
=
0
;
int
argv_quiet
=
0
;
int
argv_batch
=
0
;
int
argv_batch
=
0
;
int
loops
=
2
,
reconnect
=
0
,
timeout
=
0
;
int
loops
=
2
,
reconnect
=
0
,
timeout
=
0
;
...
@@ -1340,7 +1354,7 @@ int main(int argc, char *argv[])
...
@@ -1340,7 +1354,7 @@ int main(int argc, char *argv[])
esl_global_set_default_logger
(
6
);
/* default debug level to 6 (info) */
esl_global_set_default_logger
(
6
);
/* default debug level to 6 (info) */
for
(;;)
{
for
(;;)
{
int
option_index
=
0
;
int
option_index
=
0
;
opt
=
getopt_long
(
argc
,
argv
,
"H:
U:P:S:u:p:d:x:l:
t:qrRhib?n"
,
options
,
&
option_index
);
opt
=
getopt_long
(
argc
,
argv
,
"H:
P:S:u:p:d:x:l:U
t:qrRhib?n"
,
options
,
&
option_index
);
if
(
opt
==
-
1
)
break
;
if
(
opt
==
-
1
)
break
;
switch
(
opt
)
{
switch
(
opt
)
{
case
'H'
:
case
'H'
:
...
@@ -1383,6 +1397,9 @@ int main(int argc, char *argv[])
...
@@ -1383,6 +1397,9 @@ int main(int argc, char *argv[])
case
'l'
:
case
'l'
:
esl_set_string
(
argv_loglevel
,
optarg
);
esl_set_string
(
argv_loglevel
,
optarg
);
break
;
break
;
case
'U'
:
argv_log_uuid
=
1
;
break
;
case
'q'
:
case
'q'
:
argv_quiet
=
1
;
argv_quiet
=
1
;
break
;
break
;
...
@@ -1445,6 +1462,9 @@ int main(int argc, char *argv[])
...
@@ -1445,6 +1462,9 @@ int main(int argc, char *argv[])
esl_set_string
(
profile
->
loglevel
,
argv_loglevel
);
esl_set_string
(
profile
->
loglevel
,
argv_loglevel
);
profile
->
quiet
=
0
;
profile
->
quiet
=
0
;
}
}
if
(
argv_log_uuid
)
{
profile
->
log_uuid
=
1
;
}
esl_log
(
ESL_LOG_DEBUG
,
"Using profile %s [%s]
\n
"
,
profile
->
name
,
profile
->
host
);
esl_log
(
ESL_LOG_DEBUG
,
"Using profile %s [%s]
\n
"
,
profile
->
name
,
profile
->
host
);
esl_set_string
(
prompt_color
,
profile
->
prompt_color
);
esl_set_string
(
prompt_color
,
profile
->
prompt_color
);
esl_set_string
(
input_text_color
,
profile
->
input_text_color
);
esl_set_string
(
input_text_color
,
profile
->
input_text_color
);
...
...
src/mod/loggers/mod_console/mod_console.c
浏览文件 @
2fd21a47
...
@@ -60,6 +60,7 @@ static switch_memory_pool_t *module_pool = NULL;
...
@@ -60,6 +60,7 @@ static switch_memory_pool_t *module_pool = NULL;
static
switch_hash_t
*
log_hash
=
NULL
;
static
switch_hash_t
*
log_hash
=
NULL
;
static
uint32_t
all_level
=
0
;
static
uint32_t
all_level
=
0
;
static
int32_t
hard_log_level
=
SWITCH_LOG_DEBUG
;
static
int32_t
hard_log_level
=
SWITCH_LOG_DEBUG
;
static
switch_bool_t
log_uuid
=
SWITCH_FALSE
;
//static int32_t failed_write = 0;
//static int32_t failed_write = 0;
static
void
del_mapping
(
char
*
var
)
static
void
del_mapping
(
char
*
var
)
{
{
...
@@ -138,6 +139,8 @@ static switch_status_t config_logger(void)
...
@@ -138,6 +139,8 @@ static switch_status_t config_logger(void)
#endif
#endif
}
else
if
(
!
strcasecmp
(
var
,
"loglevel"
)
&&
!
zstr
(
val
))
{
}
else
if
(
!
strcasecmp
(
var
,
"loglevel"
)
&&
!
zstr
(
val
))
{
hard_log_level
=
switch_log_str2level
(
val
);
hard_log_level
=
switch_log_str2level
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"uuid"
)
&&
switch_true
(
val
))
{
log_uuid
=
SWITCH_TRUE
;
}
}
}
}
}
}
...
@@ -244,11 +247,21 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
...
@@ -244,11 +247,21 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
DWORD
len
=
(
DWORD
)
strlen
(
node
->
data
);
DWORD
len
=
(
DWORD
)
strlen
(
node
->
data
);
DWORD
outbytes
=
0
;
DWORD
outbytes
=
0
;
SetConsoleTextAttribute
(
hStdout
,
COLORS
[
node
->
level
]);
SetConsoleTextAttribute
(
hStdout
,
COLORS
[
node
->
level
]);
if
(
log_uuid
&&
!
zstr
(
node
->
userdata
))
{
WriteFile
(
hStdout
,
node
->
userdata
,
strlen
(
node
->
userdata
),
&
outbytes
,
NULL
);
WriteFile
(
hStdout
,
" "
,
strlen
(
" "
),
&
outbytes
,
NULL
);
}
WriteFile
(
hStdout
,
node
->
data
,
len
,
&
outbytes
,
NULL
);
WriteFile
(
hStdout
,
node
->
data
,
len
,
&
outbytes
,
NULL
);
SetConsoleTextAttribute
(
hStdout
,
wOldColorAttrs
);
SetConsoleTextAttribute
(
hStdout
,
wOldColorAttrs
);
#else
#else
fprintf
(
handle
,
"%s%s%s"
,
COLORS
[
node
->
level
],
node
->
data
,
SWITCH_SEQ_DEFAULT_COLOR
);
if
(
log_uuid
&&
!
zstr
(
node
->
userdata
))
{
fprintf
(
handle
,
"%s%s %s%s"
,
COLORS
[
node
->
level
],
node
->
userdata
,
node
->
data
,
SWITCH_SEQ_DEFAULT_COLOR
);
}
else
{
fprintf
(
handle
,
"%s%s%s"
,
COLORS
[
node
->
level
],
node
->
data
,
SWITCH_SEQ_DEFAULT_COLOR
);
}
#endif
#endif
}
else
if
(
log_uuid
&&
!
zstr
(
node
->
userdata
))
{
fprintf
(
handle
,
"%s %s"
,
node
->
userdata
,
node
->
data
);
}
else
{
}
else
{
fprintf
(
handle
,
"%s"
,
node
->
data
);
fprintf
(
handle
,
"%s"
,
node
->
data
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论