Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
552be2a6
Commit
552be2a6
authored
Aug 23, 2017
by
jehan
Browse files
small rework of trace level management.
parent
8c98297a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
47 additions
and
51 deletions
+47
-51
coreapi/bellesip_sal/sal_impl.c
coreapi/bellesip_sal/sal_impl.c
+16
-34
coreapi/help/examples/C/CMakeLists.txt
coreapi/help/examples/C/CMakeLists.txt
+1
-1
coreapi/linphonecore.c
coreapi/linphonecore.c
+9
-9
daemon/CMakeLists.txt
daemon/CMakeLists.txt
+1
-1
include/linphone/core.h
include/linphone/core.h
+8
-0
include/sal/sal.h
include/sal/sal.h
+2
-0
tester/accountmanager.c
tester/accountmanager.c
+1
-1
tester/liblinphone_tester.c
tester/liblinphone_tester.c
+1
-2
tester/register_tester.c
tester/register_tester.c
+5
-0
tester/tester.c
tester/tester.c
+1
-1
tools/CMakeLists.txt
tools/CMakeLists.txt
+2
-2
No files found.
coreapi/bellesip_sal/sal_impl.c
View file @
552be2a6
...
...
@@ -59,31 +59,6 @@ void sal_op_set_privacy_from_message(SalOp* op,belle_sip_message_t* msg) {
}
static
void
set_tls_properties
(
Sal
*
ctx
);
void
_belle_sip_log
(
const
char
*
domain
,
belle_sip_log_level
lev
,
const
char
*
fmt
,
va_list
args
)
{
OrtpLogLevel
ortp_level
;
switch
(
lev
)
{
case
BELLE_SIP_LOG_FATAL
:
ortp_level
=
ORTP_FATAL
;
break
;
case
BELLE_SIP_LOG_ERROR
:
ortp_level
=
ORTP_ERROR
;
break
;
case
BELLE_SIP_LOG_WARNING
:
ortp_level
=
ORTP_WARNING
;
break
;
case
BELLE_SIP_LOG_MESSAGE
:
ortp_level
=
ORTP_MESSAGE
;
break
;
case
BELLE_SIP_LOG_DEBUG
:
default:
ortp_level
=
ORTP_DEBUG
;
break
;
}
if
(
ortp_log_level_enabled
(
"belle-sip"
,
ortp_level
)){
ortp_logv
(
"belle-sip"
,
ortp_level
,
fmt
,
args
);
}
}
void
sal_enable_log
(){
sal_set_log_level
(
ORTP_MESSAGE
);
}
...
...
@@ -93,24 +68,31 @@ void sal_disable_log() {
}
void
sal_set_log_level
(
OrtpLogLevel
level
)
{
belle_sip_log_level
belle_sip_level
;
belle_sip_log_level
belle_sip_level
=
BELLE_SIP_LOG_MESSAGE
;
if
((
level
&
ORTP_FATAL
)
!=
0
)
{
belle_sip_level
=
BELLE_SIP_LOG_FATAL
;
}
else
if
((
level
&
ORTP_ERROR
)
!=
0
)
{
}
if
((
level
&
ORTP_ERROR
)
!=
0
)
{
belle_sip_level
=
BELLE_SIP_LOG_ERROR
;
}
else
if
((
level
&
ORTP_WARNING
)
!=
0
)
{
}
if
((
level
&
ORTP_WARNING
)
!=
0
)
{
belle_sip_level
=
BELLE_SIP_LOG_WARNING
;
}
else
if
((
level
&
ORTP_MESSAGE
)
!=
0
)
{
}
if
((
level
&
ORTP_MESSAGE
)
!=
0
)
{
belle_sip_level
=
BELLE_SIP_LOG_MESSAGE
;
}
else
if
(((
level
&
ORTP_DEBUG
)
!=
0
)
||
((
level
&
ORTP_TRACE
)
!=
0
))
{
}
if
(((
level
&
ORTP_DEBUG
)
!=
0
)
||
((
level
&
ORTP_TRACE
)
!=
0
))
{
belle_sip_level
=
BELLE_SIP_LOG_DEBUG
;
}
else
{
//well, this should never occurs but...
belle_sip_level
=
BELLE_SIP_LOG_MESSAGE
;
}
belle_sip_set_log_level
(
belle_sip_level
);
}
static
BctbxLogFunc
_belle_sip_log_handler
=
bctbx_logv_out
;
void
sal_set_log_handler
(
BctbxLogFunc
log_handler
)
{
_belle_sip_log_handler
=
log_handler
;
belle_sip_set_log_handler
(
log_handler
);
}
void
sal_add_pending_auth
(
Sal
*
sal
,
SalOp
*
op
){
if
(
bctbx_list_find
(
sal
->
pending_auths
,
op
)
==
NULL
){
sal
->
pending_auths
=
bctbx_list_append
(
sal
->
pending_auths
,
op
);
...
...
@@ -505,7 +487,7 @@ Sal * sal_init(MSFactory *factory){
sal
->
auto_contacts
=
TRUE
;
sal
->
factory
=
factory
;
/*first create the stack, which initializes the belle-sip object's pool for this thread*/
belle_sip_set_log_handler
(
_belle_sip_log
);
belle_sip_set_log_handler
(
_belle_sip_log
_handler
);
//printf by default
sal
->
stack
=
belle_sip_stack_new
(
NULL
);
sal
->
user_agent
=
belle_sip_header_user_agent_new
();
...
...
coreapi/help/examples/C/CMakeLists.txt
View file @
552be2a6
...
...
@@ -29,7 +29,7 @@ if (ENABLE_TOOLS)
string
(
REPLACE
".c"
""
EXECUTABLE_NAME
${
EXECUTABLE
}
)
bc_apply_compile_flags
(
${
EXECUTABLE
}
STRICT_OPTIONS_CPP STRICT_OPTIONS_C
)
add_executable
(
${
EXECUTABLE_NAME
}
${
USE_BUNDLE
}
${
EXECUTABLE
}
)
target_link_libraries
(
${
EXECUTABLE_NAME
}
${
LINPHONE_LIBS_FOR_TOOLS
}
${
MEDIASTREAMER2_LIBRARIES
}
${
ORTP_LIBRARIES
}
)
target_link_libraries
(
${
EXECUTABLE_NAME
}
${
LINPHONE_LIBS_FOR_TOOLS
}
${
MEDIASTREAMER2_LIBRARIES
}
${
ORTP_LIBRARIES
}
${
BCTOOLBOX_CORE_LIBRARIES
}
)
set_target_properties
(
${
EXECUTABLE_NAME
}
PROPERTIES LINK_FLAGS
"
${
LINPHONE_LDFLAGS
}
"
)
if
(
NOT IOS
)
install
(
TARGETS
${
EXECUTABLE_NAME
}
...
...
coreapi/linphonecore.c
View file @
552be2a6
...
...
@@ -468,7 +468,9 @@ void linphone_core_set_log_handler(OrtpLogFunc logfunc) {
void
linphone_core_set_log_file
(
FILE
*
file
)
{
if
(
file
==
NULL
)
file
=
stdout
;
ortp_set_log_file
(
file
);
bctbx_set_log_file
(
file
);
/*gather everythings*/
sal_set_log_handler
(
NULL
);
/*disable default log handler*/
ortp_set_log_handler
(
NULL
);
/*disable default log handler*/
}
void
linphone_core_set_log_level
(
OrtpLogLevel
loglevel
)
{
...
...
@@ -497,15 +499,13 @@ void linphone_core_set_log_level(OrtpLogLevel loglevel) {
}
void
linphone_core_set_log_level_mask
(
unsigned
int
loglevel
)
{
ortp_set_log_level_mask
(
NULL
,
loglevel
);
bctbx_set_log_level_mask
(
NULL
,
loglevel
);
if
(
loglevel
==
0
)
{
sal_disable_log
();
}
else
{
sal_enable_log
();
}
//we only have 2 domain for now ortp and belle-sip
bctbx_set_log_level_mask
(
ORTP_LOG_DOMAIN
,
loglevel
);
sal_set_log_level
((
OrtpLogLevel
)
loglevel
);
}
unsigned
int
linphone_core_get_log_level_mask
(
void
)
{
return
bctbx_get_log_level_mask
(
ORTP_LOG_DOMAIN
);
}
static
int
_open_log_collection_file_with_idx
(
int
idx
)
{
struct
stat
statbuf
;
char
*
log_filename
;
...
...
daemon/CMakeLists.txt
View file @
552be2a6
...
...
@@ -119,7 +119,7 @@ target_link_libraries(linphone-daemon ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER
set_target_properties
(
linphone-daemon PROPERTIES LINK_FLAGS
"
${
LINPHONE_LDFLAGS
}
"
)
add_executable
(
linphone-daemon-pipetest
${
DAEMON_PIPETEST_SOURCE_FILES
}
)
target_link_libraries
(
linphone-daemon-pipetest
${
LINPHONE_LIBS_FOR_TOOLS
}
${
ORTP_LIBRARIES
}
)
target_link_libraries
(
linphone-daemon-pipetest
${
LINPHONE_LIBS_FOR_TOOLS
}
${
ORTP_LIBRARIES
}
${
BCTOOLBOX_CORE_LIBRARIES
}
)
set_target_properties
(
linphone-daemon-pipetest PROPERTIES LINK_FLAGS
"
${
LINPHONE_LDFLAGS
}
"
)
set
(
INSTALL_TARGETS linphone-daemon linphone-daemon-pipetest
)
...
...
include/linphone/core.h
View file @
552be2a6
...
...
@@ -803,6 +803,14 @@ LINPHONE_PUBLIC void linphone_core_set_log_level(OrtpLogLevel loglevel);
*/
LINPHONE_PUBLIC
void
linphone_core_set_log_level_mask
(
unsigned
int
loglevel
);
/**
* Get defined log level mask.
*
* @return The loglevel parameter is a bitmask parameter. Therefore to enable only warning and error
* messages, use ORTP_WARNING | ORTP_ERROR. To disable logs, simply set loglevel to 0.
*/
LINPHONE_PUBLIC
unsigned
int
linphone_core_get_log_level_mask
(
void
);
/**
* Enable logs in supplied FILE*.
* @param file a C FILE* where to fprintf logs. If null stdout is used.
...
...
include/sal/sal.h
View file @
552be2a6
...
...
@@ -148,6 +148,8 @@ const char *sal_address_get_header(const SalAddress *addr, const char *name);
LINPHONE_PUBLIC
Sal
*
sal_init
(
MSFactory
*
factory
);
LINPHONE_PUBLIC
void
sal_uninit
(
Sal
*
sal
);
void
sal_set_log_handler
(
BctbxLogFunc
log_handler
);
void
sal_set_user_pointer
(
Sal
*
sal
,
void
*
user_data
);
void
*
sal_get_user_pointer
(
const
Sal
*
sal
);
...
...
tester/accountmanager.c
View file @
552be2a6
...
...
@@ -259,7 +259,7 @@ static LinphoneAddress *account_manager_check_account(AccountManager *m, Linphon
void
linphone_core_manager_check_accounts
(
LinphoneCoreManager
*
m
){
const
bctbx_list_t
*
it
;
AccountManager
*
am
=
account_manager_get
();
int
logmask
=
ortp
_get_log_level_mask
(
NULL
);
int
logmask
=
linphone_core
_get_log_level_mask
();
if
(
!
liblinphonetester_show_account_manager_logs
)
linphone_core_set_log_level_mask
(
ORTP_ERROR
|
ORTP_FATAL
);
for
(
it
=
linphone_core_get_proxy_config_list
(
m
->
lc
);
it
!=
NULL
;
it
=
it
->
next
){
...
...
tester/liblinphone_tester.c
View file @
552be2a6
...
...
@@ -195,8 +195,7 @@ int liblinphone_tester_set_log_file(const char *filename) {
return
-
1
;
}
ms_message
(
"Redirecting traces to file [%s]"
,
filename
);
bctbx_set_log_file
(
log_file
);
ortp_set_log_file
(
log_file
);
linphone_core_set_log_file
(
log_file
);
return
0
;
}
...
...
tester/register_tester.c
View file @
552be2a6
...
...
@@ -684,6 +684,11 @@ static void proxy_transport_change(void){
linphone_core_manager_destroy
(
lcm
);
}
/*
* On ios, some firewal require to disable flow label (livebox with default firewall level).
* sudo sysctl net.inet6.ip6.auto_flowlabel=0
* It might be possible to found a sockopt for such purpose.
*/
static
void
proxy_transport_change_with_wrong_port
(
void
)
{
LinphoneCoreManager
*
lcm
=
create_lcm
();
stats
*
counters
=
&
lcm
->
stat
;
...
...
tester/tester.c
View file @
552be2a6
...
...
@@ -461,7 +461,7 @@ void linphone_core_manager_stop(LinphoneCoreManager *mgr){
}
void
linphone_core_manager_uninit
(
LinphoneCoreManager
*
mgr
)
{
int
old_log_level
=
ortp
_get_log_level_mask
(
NULL
);
int
old_log_level
=
linphone_core
_get_log_level_mask
();
linphone_core_set_log_level
(
ORTP_ERROR
);
if
(
mgr
->
phone_alias
)
{
ms_free
(
mgr
->
phone_alias
);
...
...
tools/CMakeLists.txt
View file @
552be2a6
...
...
@@ -33,7 +33,7 @@ endif()
set
(
LP_AUTO_ANSWER_SOURCE_FILES auto_answer.c
)
bc_apply_compile_flags
(
LP_AUTO_ANSWER_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C
)
add_executable
(
lp-auto-answer
${
USE_BUNDLE
}
${
LP_AUTO_ANSWER_SOURCE_FILES
}
)
target_link_libraries
(
lp-auto-answer
${
LINPHONE_LIBS_FOR_TOOLS
}
${
MEDIASTREAMER2_LIBRARIES
}
${
ORTP_LIBRARIES
}
${
BCTOOLBOX_LIBRARIES
}
)
target_link_libraries
(
lp-auto-answer
${
LINPHONE_LIBS_FOR_TOOLS
}
${
MEDIASTREAMER2_LIBRARIES
}
${
ORTP_LIBRARIES
}
${
BCTOOLBOX_
CORE_
LIBRARIES
}
)
set_target_properties
(
lp-auto-answer PROPERTIES LINK_FLAGS
"
${
LINPHONE_LDFLAGS
}
"
)
set
(
LP_SENDMSG_SOURCE_FILES lpsendmsg.c
)
...
...
@@ -57,7 +57,7 @@ set_target_properties(xml2lpc_test PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set
(
LP_TEST_ECC_SOURCE_FILES test_ecc.c
)
bc_apply_compile_flags
(
LP_TEST_ECC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C
)
add_executable
(
lp-test-ecc
${
USE_BUNDLE
}
${
LP_TEST_ECC_SOURCE_FILES
}
)
target_link_libraries
(
lp-test-ecc
${
LINPHONE_LIBS_FOR_TOOLS
}
${
ORTP_LIBRARIES
}
${
MEDIASTREAMER2_LIBRARIES
}
)
target_link_libraries
(
lp-test-ecc
${
LINPHONE_LIBS_FOR_TOOLS
}
${
ORTP_LIBRARIES
}
${
MEDIASTREAMER2_LIBRARIES
}
${
BCTOOLBOX_CORE_LIBRARIES
}
)
set_target_properties
(
lp-test-ecc PROPERTIES LINK_FLAGS
"
${
LINPHONE_LDFLAGS
}
"
)
if
(
NOT IOS
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment