X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fmain.cpp;h=599e4fe7ca9adf6fe6004a39f660f8e1ec36f9bb;hp=6f2a6533851bde43ef661fca1bde878f957987b2;hb=4e62c7a87e40daab037ea709989e185efddc18c8;hpb=64d7c531cdf5f4bca4fa2d8c9736de98247dfe13 diff --git a/example/diameter/launcher/main.cpp b/example/diameter/launcher/main.cpp index 6f2a653..599e4fe 100644 --- a/example/diameter/launcher/main.cpp +++ b/example/diameter/launcher/main.cpp @@ -17,10 +17,22 @@ // Process #include +// To calculate the current working directory and get an absolute path for traces: +#include +#include + int main(int argc, const char** argv) { anna::Logger::setLevel(anna::Logger::Warning); - anna::Logger::initialize("launcher", new TraceWriter("launcher.trace", 2048000)); + + // Current working directory and absolute trace path file: + char c_exe[ PATH_MAX ]; + ssize_t count = readlink( "/proc/self/exe", c_exe, PATH_MAX ); + std::string exe(c_exe, (count > 0) ? count : 0 ); + std::string cwd = exe.substr(0, exe.find_last_of("/")); + std::string trace_file = cwd + "/launcher.trace"; + + anna::Logger::initialize("launcher", new TraceWriter(trace_file, 2048000)); anna::time::functions::initialize(); // before application instantiation (it have a anna::time object) anna::time::functions::setControlPoint(); // start control point (application lifetime) Launcher app;