[DEBUG] correct the specific log for a library

This commit is contained in:
Edouard DUPIN 2016-07-25 21:22:27 +02:00
parent 44d04b66a5
commit ffe3e5804b

View File

@ -67,6 +67,7 @@ void elog::init(int _argc, const char** _argv) {
for (int32_t iii=0; iii<_argc ; ++iii) { for (int32_t iii=0; iii<_argc ; ++iii) {
std::string data = _argv[iii]; std::string data = _argv[iii];
if (startWith(data, "--elog-level=")) { 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()))); elog::setLevel(getLogLevel(std::string(data.begin()+13, data.end())));
} else if (startWith(data, "--elog-color")) { } else if (startWith(data, "--elog-color")) {
elog::setColor(true); elog::setColor(true);
@ -98,12 +99,19 @@ void elog::init(int _argc, const char** _argv) {
} }
} }
} else if (startWith(data, "--elog-lib=")) { } else if (startWith(data, "--elog-lib=")) {
std::string value(data.begin()+14, data.end()); std::string value(data.begin()+11, data.end());
std::vector<std::string> list = split(value, ':'); std::vector<std::string> list = split(value, '/');
if (list.size() != 2) { if (list.size() != 2) {
ELOG_ERROR("Can not set the --elog-lib= with value='" << value << "' not formated name:X"); list = split(value, ':');
continue; 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])); elog::setLevel(list[0], getLogLevel(list[1]));
} else if ( data == "-h" } else if ( data == "-h"
|| data == "--help") { || 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(" --elog-lib=name:X Set a library specific level:");
ELOG_PRINT(" name Name of the library"); ELOG_PRINT(" name Name of the library");
ELOG_PRINT(" X Log level to set [0..6]"); 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-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-no-color Disable color in log (default in Linux/release and Other)");
ELOG_PRINT(" --elog-config= Configure the Log interface"); ELOG_PRINT(" --elog-config= Configure the Log interface");