diff --git a/etk/debug.h b/etk/debug.h index 91df8c8..875e51a 100644 --- a/etk/debug.h +++ b/etk/debug.h @@ -19,6 +19,7 @@ namespace etk { #define ETK_BASE(info,data) TK_LOG_BASE(etk::getLogId(),info,data) +#define TK_PRINT(data) ETK_BASE(-1, data) #define TK_CRITICAL(data) ETK_BASE(1, data) #define TK_ERROR(data) ETK_BASE(2, data) #define TK_WARNING(data) ETK_BASE(3, data) diff --git a/etk/etk.cpp b/etk/etk.cpp index 9367633..cafcf03 100644 --- a/etk/etk.cpp +++ b/etk/etk.cpp @@ -81,31 +81,31 @@ void etk::init(int _argc, const char** _argv) { } else if ( data == "-h" || data == "--help") { etk::log::setLevel(etk::log::logLevelInfo); - TK_INFO("etk - help : "); - TK_INFO(" " << _argv[0] << " [options]"); - TK_INFO(" -l/--etk-log-level= Change the default log level (set all Log lovel):"); - TK_INFO(" 0: debug None (default in release)"); - TK_INFO(" 1: debug Critical"); - TK_INFO(" 2: debug Error"); - TK_INFO(" 3: debug Warning"); - TK_INFO(" 4: debug Info (default in debug)"); - TK_INFO(" 5: debug Debug"); - TK_INFO(" 6: debug Verbose"); - TK_INFO(" --etk-log-lib=name:X Set a library specific level:"); - TK_INFO(" name Name of the library"); - TK_INFO(" X Log level to set [0..6]"); - TK_INFO(" --etk-log-color Enable color in log (default in Linux/debug)"); - TK_INFO(" --etk-log-no-color Disable color in log (default in Linux/release and Other)"); - TK_INFO(" --etk-log-config= Configure the Log interface"); - TK_INFO(" t: diplay time"); - TK_INFO(" T: diplay thread id"); - TK_INFO(" N: diplay thread name"); - TK_INFO(" L: diplay line number"); - TK_INFO(" l: diplay lib name"); - TK_INFO(" f: diplay fundtion name"); - TK_INFO(" -h/--help: this help"); - TK_INFO(" example:"); - TK_INFO(" " << _argv[0] << " --etk-log-color --etk-log-level=2 --etk-log-lib=etk:5 --etk-log-lib=appl:6 --etk-log-config=NLlf"); + TK_PRINT("etk - help : "); + TK_PRINT(" " << _argv[0] << " [options]"); + TK_PRINT(" -l/--etk-log-level= Change the default log level (set all Log lovel):"); + TK_PRINT(" 0: debug None (default in release)"); + TK_PRINT(" 1: debug Critical"); + TK_PRINT(" 2: debug Error"); + TK_PRINT(" 3: debug Warning"); + TK_PRINT(" 4: debug Info (default in debug)"); + TK_PRINT(" 5: debug Debug"); + TK_PRINT(" 6: debug Verbose"); + TK_PRINT(" --etk-log-lib=name:X Set a library specific level:"); + TK_PRINT(" name Name of the library"); + TK_PRINT(" X Log level to set [0..6]"); + TK_PRINT(" --etk-log-color Enable color in log (default in Linux/debug)"); + TK_PRINT(" --etk-log-no-color Disable color in log (default in Linux/release and Other)"); + TK_PRINT(" --etk-log-config= Configure the Log interface"); + TK_PRINT(" t: diplay time"); + TK_PRINT(" T: diplay thread id"); + TK_PRINT(" N: diplay thread name"); + TK_PRINT(" L: diplay line number"); + TK_PRINT(" l: diplay lib name"); + TK_PRINT(" f: diplay fundtion name"); + TK_PRINT(" -h/--help: this help"); + TK_PRINT(" example:"); + TK_PRINT(" " << _argv[0] << " --etk-log-color --etk-log-level=2 --etk-log-lib=etk:5 --etk-log-lib=appl:6 --etk-log-config=NLlf"); } else if (etk::start_with(data, "--etk")) { TK_ERROR("Can not parse the argument : '" << data << "'"); } diff --git a/etk/log.cpp b/etk/log.cpp index 4db23d5..15235b9 100644 --- a/etk/log.cpp +++ b/etk/log.cpp @@ -319,6 +319,9 @@ void etk::log::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* case logLevelVerbose: strcat(pointer, ETK_BASH_COLOR_WHITE); break; + case logLevelPrint: + strcat(pointer, ETK_BASH_COLOR_WHITE); + break; } pointer = handle+strlen(handle); } @@ -333,6 +336,9 @@ void etk::log::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* default: strcat(pointer, "[?] "); break; + case logLevelPrint: + strcat(pointer, "[P] "); + break; case logLevelCritical: strcat(pointer, "[C] "); break; @@ -452,6 +458,9 @@ void etk::log::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* default: //ROS_VERBOSE_STREAM(handle); break; + case logLevelPrint: + ROS_INFO_STREAM(handle); + break; case logLevelCritical: ROS_FATAL_STREAM(handle); break; @@ -478,6 +487,9 @@ void etk::log::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* default: __android_log_print(ANDROID_LOG_VERBOSE, "EWOL", "%s", handle); break; + case logLevelPrint: + __android_log_print(ANDROID_LOG_INFO, "EWOL", "%s", handle); + break; case logLevelCritical: __android_log_print(ANDROID_LOG_FATAL, "EWOL", "%s", handle); break; diff --git a/etk/log.h b/etk/log.h index a2f09a1..ec52b85 100644 --- a/etk/log.h +++ b/etk/log.h @@ -20,6 +20,7 @@ namespace etk { * @brief Log level is a simple list of all log availlable. This enum is used when setting a log and when user chose the level of log displayed. */ enum level { + logLevelPrint = -1, //!< basic print for Help or result (never filtered) logLevelNone = 0, //!< no display requested logLevelCritical = 1, //!< Display only critical logs (note that critical generally assert with a backtrace (when we can)) logLevelError = 2, //!< Display Error and critical logs