Skip to content

Commit

Permalink
trace: remove global default trace json (#969)
Browse files Browse the repository at this point in the history
Trace initialization should be handled by application (moving this to baresip)
  • Loading branch information
sreimers authored Sep 29, 2023
1 parent 4c4c74f commit 51e3c4d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ libre.*dylib
libre.pc
libre.so*
*.gcov
re_trace.json

# Windows build folder
Win32/*
Expand Down
8 changes: 0 additions & 8 deletions src/main/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ int libre_init(void)
return err;
}

#ifdef RE_TRACE_ENABLED
re_trace_init("re_trace.json");
#endif

err = re_thread_init();

return err;
Expand All @@ -183,10 +179,6 @@ int libre_init(void)
*/
void libre_close(void)
{

#ifdef RE_TRACE_ENABLED
re_trace_close();
#endif
(void)fd_setsize(0);
net_sock_close();
re_thread_close();
Expand Down
15 changes: 15 additions & 0 deletions test/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ int test_trace(void)
if (test_mode == TEST_THREAD)
return ESKIPPED;

err = re_trace_init("test_trace.json");
TEST_ERR(err);

RE_TRACE_PROCESS_NAME("retest");
RE_TRACE_THREAD_NAME("test_trace");
RE_TRACE_BEGIN("test", "Test Loop Start");
Expand All @@ -51,6 +54,18 @@ int test_trace(void)

RE_TRACE_END("test", "Test Loop End");

err = re_trace_close();
TEST_ERR(err);

/* Test TRACE after close - should do nothing */
RE_TRACE_BEGIN("test", "test after close");

#ifdef WIN32
(void)_unlink("test_trace.json");
#else
(void)unlink("test_trace.json");
#endif

out:
return err;
}

0 comments on commit 51e3c4d

Please sign in to comment.