[DEV] update new etk file interface

This commit is contained in:
Edouard DUPIN 2018-09-18 22:51:05 +02:00
parent 1f5e6637ec
commit 861ac881ac
2 changed files with 12 additions and 21 deletions

View File

@ -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
}

View File

@ -9,17 +9,18 @@
#include <etk/String.hpp>
/**
* @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();
}