From 861ac881ac51e263311bfd8a184f90a7618017a2 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 18 Sep 2018 22:51:05 +0200 Subject: [PATCH] [DEV] update new etk file interface --- elog/elog.cpp | 20 +++++--------------- elog/elog.hpp | 13 +++++++------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/elog/elog.cpp b/elog/elog.cpp index dd47e2a..c3a93e2 100644 --- a/elog/elog.cpp +++ b/elog/elog.cpp @@ -66,7 +66,7 @@ void elog::unInit() { ELOG_INFO("E-log system un-init (END)"); } -void elog::init(int _argc, const char** _argv) { +void elog::init(int _argc, const char** _argv, const etk::String& _applName) { if (nbTimeInit > 0) { nbTimeInit++; // already init @@ -74,16 +74,6 @@ void elog::init(int _argc, const char** _argv) { } nbTimeInit++; ELOG_INFO("E-log system init (BEGIN)"); - // retrive application Name: - etk::String applName = "noApplicationName"; - #if !defined(__TARGET_OS__Android) and !defined(__TARGET_OS__IOs) - if (_argc >= 1) { - applName = _argv[0]; - int lastSlash = applName.rfind('/'); - applName = &applName[lastSlash+1]; - } - #endif - // get name: applName bool userSpecifyLogFile = false; for (int32_t iii=0; iii<_argc ; ++iii) { etk::String data = _argv[iii]; @@ -199,12 +189,12 @@ void elog::init(int _argc, const char** _argv) { #endif #else #if defined(__TARGET_OS__Linux) - //elog::setLogInFile("/var/log/elog_" +applName + ".log"); - elog::setLogInFile("/tmp/elog_" +applName + ".log"); + //elog::setLogInFile("/var/log/elog_" +_applName + ".log"); + elog::setLogInFile("/tmp/elog_" +_applName + ".log"); #elif defined(__TARGET_OS__MacOs) - elog::setLogInFile(applName + ".log"); + elog::setLogInFile(_applName + ".log"); #elif defined(__TARGET_OS__Windows) - elog::setLogInFile(applName + ".log"); + elog::setLogInFile(_applName + ".log"); #endif #endif } diff --git a/elog/elog.hpp b/elog/elog.hpp index ca43443..411d527 100644 --- a/elog/elog.hpp +++ b/elog/elog.hpp @@ -9,17 +9,18 @@ #include /** - * @brief basic namespace of the elog library. (it might contain all the elog fuctions without macro) + * @brief basic namespace of the elog library. (it might contain all the elog fuctions without macro). */ namespace elog { /** - * @brief Initialize elog - * @param[in] _argc Number of argument list - * @param[in] _argv List of arguments + * @brief Initialize elog. + * @param[in] _argc Number of argument list. + * @param[in] _argv List of arguments. + * @param[in] _applName Current application Name. */ - void init(int _argc, const char** _argv); + void init(int _argc, const char** _argv, const etk::String& _applName); /** - * @brief Un-Initialize elog + * @brief Un-Initialize elog. */ void unInit(); }