diff --git a/elog/log.cpp b/elog/log.cpp index 35f1ff0..c1a65e2 100644 --- a/elog/log.cpp +++ b/elog/log.cpp @@ -9,16 +9,12 @@ #include #include #include -#include -#include +#include +#include #include #include -#ifdef ELOG_BUILD_ETHREAD - #include -#endif +#include #include -#include -#include #if defined(__TARGET_OS__Android) # include @@ -289,7 +285,7 @@ static void getDisplayTime(char* data) { #endif } -static std::mutex g_lock; +static ethread::Mutex g_lock; static elog::callbackLog callbackUserLog(nullptr); static etk::String& getLogFileName() { @@ -322,7 +318,7 @@ extern "C" { // file browsing ... #include #include - #include + #include } static int32_t FSNODE_LOCAL_mkdir(const char* _path, mode_t _mode) { @@ -331,9 +327,9 @@ static int32_t FSNODE_LOCAL_mkdir(const char* _path, mode_t _mode) { if (stat(_path, &st) != 0) { /* Directory does not exist. EEXIST for race condition */ #ifdef __TARGET_OS__Windows - if(0!=mkdir(_path) + if(mkdir(_path) != 0 #else - if(0!=mkdir(_path, _mode) + if(mkdir(_path, _mode) != 0 #endif && errno != EEXIST) { status = -1; @@ -342,7 +338,6 @@ static int32_t FSNODE_LOCAL_mkdir(const char* _path, mode_t _mode) { errno = ENOTDIR; status = -1; } - return(status); } @@ -395,7 +390,7 @@ void elog::setLogInFile(const etk::String& _filename) { } g_lock.lock(); file = fopen(_filename.c_str(), "w"); - g_lock.unlock(); + g_lock.unLock(); if (file == nullptr) { ELOG_ERROR("Can not open file: '" << _filename << "'"); } @@ -411,7 +406,7 @@ void elog::unsetLogInFile() { fclose(file); file = nullptr; } - g_lock.unlock(); + g_lock.unLock(); } @@ -419,7 +414,7 @@ void elog::setCallbackLog(const elog::callbackLog& _callback) { // TODO : Check atomicity ... g_lock.lock(); callbackUserLog = _callback; - g_lock.unlock(); + g_lock.unLock(); } //regular colors #define ETK_BASH_COLOR_BLACK "\e[0;30m" @@ -466,7 +461,7 @@ void elog::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* _fun if (callbackUserLog != nullptr) { callbackUserLog(libName, elog::level(_level), _ligne, _funcName, _log); } - g_lock.unlock(); + g_lock.unLock(); return; } char handle[LENGHT_MAX_LOG] = ""; @@ -687,7 +682,7 @@ void elog::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* _fun } } // if we log in file, we have no need to log otherwise ... just "tail -f log.txt" - g_lock.unlock(); + g_lock.unLock(); return; } } @@ -723,10 +718,10 @@ void elog::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* _fun #else printf("%s\n", handle); #endif - g_lock.unlock(); + g_lock.unLock(); if (_level == level_critical) { #if defined(DEBUG) - std::this_thread::sleep_for(std::chrono::milliseconds(700)); + ethread::sleepMilliSeconds(700); #endif displayBacktrace(true, 2); } @@ -745,6 +740,6 @@ void elog::flush() { fflush(file); } fflush(stdout); - g_lock.unlock(); + g_lock.unLock(); return; } \ No newline at end of file diff --git a/elog/log.hpp b/elog/log.hpp index e9cb04e..90b63d8 100644 --- a/elog/log.hpp +++ b/elog/log.hpp @@ -7,12 +7,11 @@ */ #pragma once -#include #include #include #include #include -#include +#include namespace elog { /** @@ -160,7 +159,7 @@ namespace elog { * @param[in] _funcName Full function name: 'void etk::MyClass::functionName(...)' * @param[in] _log String containing the Log */ - using callbackLog = std::function; + using callbackLog = etk::Function; /** * @brief Set a callback to display all log in an other framework * @param[in] _callback Function to call when log arrive diff --git a/lutin_test-debug.py b/lutin_test-debug.py index 149a40f..9007e78 100644 --- a/lutin_test-debug.py +++ b/lutin_test-debug.py @@ -32,7 +32,7 @@ def configure(target, my_module): my_module.add_header_file([ 'test-debug/debug.hpp' ]) - my_module.add_depend('etk') + my_module.add_depend('etk-base') my_module.add_path(".") return True