Commit b88e76e9 authored by François Grisez's avatar François Grisez

Merge branch 'origin/fix/api_change_of_create_file_log_handler' into 'master'

Fix build error due to API change of bctbx_create_file_log_handler()

See merge request !5
parents a84f5679 b4aec168
......@@ -25,7 +25,6 @@
#include "typedef.h"
#include "testUtils.h"
static FILE * log_file = NULL;
static const char *log_domain = "bzrtp-tester";
......@@ -41,31 +40,26 @@ static void log_handler(int lev, const char *fmt, va_list args) {
fprintf(lev == BCTBX_LOG_ERROR ? stderr : stdout, "\n");
va_end(cap);
#endif
if (log_file){
bctbx_logv(log_domain, (BctbxLogLevel)lev, fmt, args);
}
bctbx_logv(log_domain, (BctbxLogLevel)lev, fmt, 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);
int res = 0;
char *dir = bctbx_dirname(filename);
char *base = bctbx_basename(filename);
bctbx_message("Redirecting traces to file [%s]", filename);
filehandler = bctbx_create_file_log_handler(0, dir, base, log_file);
bctbx_log_handler_t *filehandler = bctbx_create_file_log_handler(0, dir, base);
if (filehandler == NULL) {
res = -1;
goto end;
}
bctbx_add_log_handler(filehandler);
end:
if (dir) bctbx_free(dir);
if (base) bctbx_free(base);
return 0;
return res;
}
int silent_arg_func(const char *arg) {
......
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