Commit ebc7bacb authored by Nicolas Michon's avatar Nicolas Michon

Fix compilation errors

parent 96fd9c0f
...@@ -46,6 +46,28 @@ static void log_handler(int lev, const char *fmt, va_list args) { ...@@ -46,6 +46,28 @@ static void log_handler(int lev, const char *fmt, va_list args) {
} }
} }
int bzrtp_tester_set_log_file(const char *filename) {
bctbx_log_handler_t* filehandler;
char* dir;
char* base;
if (log_file) {
fclose(log_file);
}
log_file = fopen(filename, "w");
if (!log_file) {
bctbx_error("Cannot open file [%s] for writing logs because [%s]", filename, strerror(errno));
return -1;
}
dir = bctbx_dirname(filename);
base = bctbx_basename(filename);
bctbx_message("Redirecting traces to file [%s]", filename);
filehandler = bctbx_create_file_log_handler(0, dir, base, log_file);
bctbx_add_log_handler(filehandler);
if (dir) bctbx_free(dir);
if (base) bctbx_free(base);
return 0;
}
int silent_arg_func(const char *arg) { int silent_arg_func(const char *arg) {
bctbx_set_log_level(log_domain, BCTBX_LOG_FATAL); bctbx_set_log_level(log_domain, BCTBX_LOG_FATAL);
bctbx_set_log_level(BCTBX_LOG_DOMAIN, BCTBX_LOG_FATAL); bctbx_set_log_level(BCTBX_LOG_DOMAIN, BCTBX_LOG_FATAL);
...@@ -61,7 +83,7 @@ int verbose_arg_func(const char *arg) { ...@@ -61,7 +83,7 @@ int verbose_arg_func(const char *arg) {
} }
int logfile_arg_func(const char *arg) { int logfile_arg_func(const char *arg) {
if (bzrtp_tester_set_log_file(argv[i]) < 0) return -2; if (bzrtp_tester_set_log_file(arg) < 0) return -2;
return 0; return 0;
} }
...@@ -83,28 +105,6 @@ void bzrtp_tester_uninit(void) { ...@@ -83,28 +105,6 @@ void bzrtp_tester_uninit(void) {
bc_tester_uninit(); bc_tester_uninit();
} }
int bzrtp_tester_set_log_file(const char *filename) {
bctbx_log_handler_t* filehandler;
char* dir;
char* base;
if (log_file) {
fclose(log_file);
}
log_file = fopen(filename, "w");
if (!log_file) {
bctbx_error("Cannot open file [%s] for writing logs because [%s]", filename, strerror(errno));
return -1;
}
dir = bctbx_dirname(filename);
base = bctbx_basename(filename);
bctbx_message("Redirecting traces to file [%s]", filename);
filehandler = bctbx_create_file_log_handler(0, dir, base, log_file);
bctbx_add_log_handler(filehandler);
if (dir) bctbx_free(dir);
if (base) bctbx_free(base);
return 0;
}
#if !defined(__ANDROID__) && !(defined(BCTBX_WINDOWS_PHONE) || defined(BCTBX_WINDOWS_UNIVERSAL)) #if !defined(__ANDROID__) && !(defined(BCTBX_WINDOWS_PHONE) || defined(BCTBX_WINDOWS_UNIVERSAL))
static const char* lime_helper = ""; static const char* lime_helper = "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment