From ffe3e5804b63a5328378a3bfe0c0b7316529732a Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 25 Jul 2016 21:22:27 +0200 Subject: [PATCH] [DEBUG] correct the specific log for a library --- elog/elog.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/elog/elog.cpp b/elog/elog.cpp index 18afb5a..c0ceceb 100644 --- a/elog/elog.cpp +++ b/elog/elog.cpp @@ -67,6 +67,7 @@ void elog::init(int _argc, const char** _argv) { for (int32_t iii=0; iii<_argc ; ++iii) { std::string data = _argv[iii]; if (startWith(data, "--elog-level=")) { + ELOG_INFO("Change global level at " << getLogLevel(std::string(data.begin()+13, data.end()))); elog::setLevel(getLogLevel(std::string(data.begin()+13, data.end()))); } else if (startWith(data, "--elog-color")) { elog::setColor(true); @@ -98,12 +99,19 @@ void elog::init(int _argc, const char** _argv) { } } } else if (startWith(data, "--elog-lib=")) { - std::string value(data.begin()+14, data.end()); - std::vector list = split(value, ':'); + std::string value(data.begin()+11, data.end()); + std::vector list = split(value, '/'); if (list.size() != 2) { - ELOG_ERROR("Can not set the --elog-lib= with value='" << value << "' not formated name:X"); - continue; + list = split(value, ':'); + if (list.size() != 2) { + list = split(value, '+'); + if (list.size() != 2) { + ELOG_ERROR("Can not set the --elog-lib= with value='" << value << "' not formated name:X or name/X or name+X"); + continue; + } + } } + ELOG_INFO("Change level of '" << list[0] << "' at " << getLogLevel(list[1])); elog::setLevel(list[0], getLogLevel(list[1])); } else if ( data == "-h" || data == "--help") { @@ -120,6 +128,7 @@ void elog::init(int _argc, const char** _argv) { ELOG_PRINT(" --elog-lib=name:X Set a library specific level:"); ELOG_PRINT(" name Name of the library"); ELOG_PRINT(" X Log level to set [0..6]"); + ELOG_PRINT(" note: ':' can be replace with '/' or '+'"); ELOG_PRINT(" --elog-color Enable color in log (default in Linux/debug)"); ELOG_PRINT(" --elog-no-color Disable color in log (default in Linux/release and Other)"); ELOG_PRINT(" --elog-config= Configure the Log interface");