forked from mirrors/linphone-iphone
Add function to set the log file of the liblinphone_tester.
This commit is contained in:
parent
8dd252fd7b
commit
205bf11aa4
2 changed files with 13 additions and 8 deletions
|
|
@ -168,6 +168,17 @@ void liblinphone_tester_uninit(void) {
|
|||
bc_tester_uninit();
|
||||
}
|
||||
|
||||
int liblinphone_tester_set_log_file(const char *filename) {
|
||||
log_file = fopen(filename, "w");
|
||||
if (!log_file) {
|
||||
ms_error("Cannot open file [%s] for writing logs because [%s]", filename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
ms_message("Redirecting traces to file [%s]", filename);
|
||||
ortp_set_log_file(log_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if !__ios && !(defined(LINPHONE_WINDOWS_PHONE) || defined(LINPHONE_WINDOWS_UNIVERSAL))
|
||||
|
||||
|
|
@ -203,14 +214,7 @@ int main (int argc, char *argv[])
|
|||
linphone_core_set_log_level(ORTP_FATAL);
|
||||
} else if (strcmp(argv[i],"--log-file")==0){
|
||||
CHECK_ARG("--log-file", ++i, argc);
|
||||
log_file=fopen(argv[i],"w");
|
||||
if (!log_file) {
|
||||
ms_error("Cannot open file [%s] for writing logs because [%s]",argv[i],strerror(errno));
|
||||
return -2;
|
||||
} else {
|
||||
ms_message("Redirecting traces to file [%s]",argv[i]);
|
||||
ortp_set_log_file(log_file);
|
||||
}
|
||||
if (liblinphone_tester_set_log_file(argv[i]) < 0) return -2;
|
||||
} else if (strcmp(argv[i],"--domain")==0){
|
||||
CHECK_ARG("--domain", ++i, argc);
|
||||
test_domain=argv[i];
|
||||
|
|
|
|||
|
|
@ -345,6 +345,7 @@ void liblinphone_tester_before_each(void);
|
|||
void liblinphone_tester_after_each(void);
|
||||
void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args));
|
||||
void liblinphone_tester_uninit(void);
|
||||
int liblinphone_tester_set_log_file(const char *filename);
|
||||
|
||||
extern const char *liblinphone_tester_mire_id;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue