mirror of
https://github.com/FairRootGroup/FairLogger.git
synced 2025-10-13 16:46:46 +00:00
Adjust regex expressions
This commit is contained in:
parent
fae704176a
commit
f3937bea6c
|
@ -37,7 +37,7 @@ int main()
|
|||
CheckOutput("^Hello world :-\\)!\n$", []() { LOGP(fatal, "Hello {} {}!", "world", ":-)"); });
|
||||
CheckOutput("^Hello world :-\\)!\n$", []() { LOGF(fatal, "Hello %s %s!", "world", ":-)"); });
|
||||
|
||||
CheckOutput(ToStr(R"(^\[FATAL])", " content\n$"), []() { LOGV(fatal, low) << "content"; });
|
||||
CheckOutput(ToStr(R"(^\[FATAL\])", " content\n$"), []() { LOGV(fatal, low) << "content"; });
|
||||
|
||||
CheckOutput("^\n\n\n\n$", []() {
|
||||
LOGN(fatal);
|
||||
|
@ -48,7 +48,7 @@ int main()
|
|||
|
||||
Logger::SetVerbosity(Verbosity::veryhigh);
|
||||
|
||||
CheckOutput(ToStr(R"(^\[.*]\[\d{2}:\d{2}:\d{2}\.\d{6}]\[FATAL]\[a:4:b])", " c\n$"), []() {
|
||||
CheckOutput(ToStr(R"(^\[.*\]\[\d{2}:\d{2}:\d{2}\.\d{6}\]\[FATAL\]\[a:4:b\])", " c\n$"), []() {
|
||||
LOGD(Severity::fatal, "a", "4", "b") << "c";
|
||||
});
|
||||
} catch (runtime_error& rte) {
|
||||
|
|
|
@ -46,7 +46,7 @@ int main()
|
|||
throw runtime_error(ToStr("File sink severity (", Logger::GetFileSeverity(), ") does not match the expected one (", Severity::warn, ")"));
|
||||
}
|
||||
|
||||
CheckOutput("^\\[FATAL] fatal\n$", [](){
|
||||
CheckOutput("^\\[FATAL\\] fatal\n$", [](){
|
||||
LOG(state) << "state";
|
||||
LOG(warn) << "warning";
|
||||
LOG(error) << "error";
|
||||
|
@ -103,7 +103,7 @@ int main()
|
|||
throw runtime_error("Did not detect a severity request from a non-existent sink");
|
||||
}
|
||||
|
||||
CheckOutput("^CustomSink warning\nCustomSink error\nCustomSink fatal\n\\[FATAL] fatal\n$", [](){
|
||||
CheckOutput("^CustomSink warning\nCustomSink error\nCustomSink fatal\n\\[FATAL\\] fatal\n$", [](){
|
||||
LOG(state) << "state";
|
||||
LOG(warn) << "warning";
|
||||
LOG(error) << "error";
|
||||
|
|
|
@ -30,11 +30,11 @@ int main()
|
|||
Logger::SetVerbosity(Verbosity::veryhigh);
|
||||
|
||||
CheckOutput(
|
||||
R"(^\[.*]\[\d{2}:\d{2}:\d{2}\.\d{6}]\[FATAL]\[.*:\d+:.*] abcdefghijklmnopqrstuvwxyz
|
||||
\[.*]\[\d{2}:\d{2}:\d{2}\.\d{6}]\[FATAL]\[.*:\d+:.*] abcdefghijklmnopqrstuvwxyz
|
||||
\[.*]\[\d{2}:\d{2}:\d{2}\.\d{6}]\[FATAL]\[.*:\d+:.*] abcdefghijklmnopqrstuvwxyz
|
||||
\[.*]\[\d{2}:\d{2}:\d{2}\.\d{6}]\[FATAL]\[.*:\d+:.*] abcdefghijklmnopqrstuvwxyz
|
||||
\[.*]\[\d{2}:\d{2}:\d{2}\.\d{6}]\[FATAL]\[.*:\d+:.*] abcdefghijklmnopqrstuvwxyz
|
||||
R"(^\[.*\]\[\d{2}:\d{2}:\d{2}\.\d{6}\]\[FATAL\]\[.*:\d+:.*\] abcdefghijklmnopqrstuvwxyz
|
||||
\[.*\]\[\d{2}:\d{2}:\d{2}\.\d{6}\]\[FATAL\]\[.*:\d+:.*\] abcdefghijklmnopqrstuvwxyz
|
||||
\[.*\]\[\d{2}:\d{2}:\d{2}\.\d{6}\]\[FATAL\]\[.*:\d+:.*\] abcdefghijklmnopqrstuvwxyz
|
||||
\[.*\]\[\d{2}:\d{2}:\d{2}\.\d{6}\]\[FATAL\]\[.*:\d+:.*\] abcdefghijklmnopqrstuvwxyz
|
||||
\[.*\]\[\d{2}:\d{2}:\d{2}\.\d{6}\]\[FATAL\]\[.*:\d+:.*\] abcdefghijklmnopqrstuvwxyz
|
||||
$)", []() {
|
||||
thread t1(f);
|
||||
thread t2(f);
|
||||
|
|
|
@ -27,47 +27,72 @@ int main()
|
|||
|
||||
Logger::DefineVerbosity(Verbosity::user1, spec1);
|
||||
Logger::SetVerbosity(Verbosity::user1); // spec1 on user1
|
||||
CheckOutput(ToStr(R"(^\[.*:\d{2}:.*]\[.*])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(ToStr(R"(^\[.*:\d{2}:.*\]\[.*\])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::DefineVerbosity(Verbosity::user1, spec2);
|
||||
Logger::SetVerbosity(Verbosity::user1); // spec2 on user1
|
||||
CheckOutput(ToStr(R"(^\[.*]\[.*:\d{2}:.*])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(ToStr(R"(^\[.*\]\[.*:\d{2}:.*\])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::DefineVerbosity(Verbosity::user2, spec1);
|
||||
Logger::SetVerbosity(Verbosity::user2); // spec1 on user2
|
||||
CheckOutput(ToStr(R"(^\[.*:\d{2}:.*]\[.*])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(ToStr(R"(^\[.*:\d{2}:.*\]\[.*\])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetVerbosity(Verbosity::verylow); // content
|
||||
CheckOutput("^content\n$", []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetVerbosity(Verbosity::low); // [severity] content
|
||||
CheckOutput(ToStr(R"(^\[FATAL])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(ToStr(R"(^\[FATAL\])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetVerbosity(Verbosity::medium); // [HH:MM:SS][severity] content
|
||||
CheckOutput(ToStr(R"(^\[\d{2}:\d{2}:\d{2}]\[FATAL])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(ToStr(R"(^\[\d{2}:\d{2}:\d{2}\]\[FATAL\])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetVerbosity(Verbosity::high); // [process_name][HH:MM:SS][severity] content
|
||||
CheckOutput(ToStr(R"(^\[.*]\[\d{2}:\d{2}:\d{2}]\[FATAL])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(ToStr(R"(^\[.*\]\[\d{2}:\d{2}:\d{2}\]\[FATAL\])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetVerbosity(Verbosity::veryhigh); // [process_name][HH:MM:SS:µS][severity][file:line:function] content
|
||||
CheckOutput(ToStr(R"(^\[.*]\[\d{2}:\d{2}:\d{2}\.\d{6}]\[FATAL]\[.*:\d+:.*])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(ToStr(R"(^\[.*\]\[\d{2}:\d{2}:\d{2}\.\d{6}\]\[FATAL\]\[.*:\d+:.*\])", " content\n$"), []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetConsoleColor(true);
|
||||
|
||||
Logger::SetVerbosity(Verbosity::verylow); // content
|
||||
CheckOutput("^content\n$", []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(
|
||||
"^"
|
||||
"content\n"
|
||||
"$", []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetVerbosity(Verbosity::low); // [severity] content
|
||||
CheckOutput("^\\[\033\\[01;31mFATAL\033\\[0m] content\n$", []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(
|
||||
"^"
|
||||
"\\[\033\\[01;31mFATAL\033\\[0m\\]"
|
||||
" content\n"
|
||||
"$", []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetVerbosity(Verbosity::medium); // [HH:MM:SS][severity] content
|
||||
CheckOutput("^\\[\033\\[01;36m\\d{2}:\\d{2}:\\d{2}\033\\[0m]\\[\033\\[01;31mFATAL\033\\[0m] content\n$", []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(
|
||||
"^"
|
||||
"\\[\033\\[01;36m\\d{2}:\\d{2}:\\d{2}\033\\[0m\\]"
|
||||
"\\[\033\\[01;31mFATAL\033\\[0m\\]"
|
||||
" content\n"
|
||||
"$", []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetVerbosity(Verbosity::high); // [process_name][HH:MM:SS][severity] content
|
||||
CheckOutput("^\\[\033\\[01;34m.*\033\\[0m]\\[\033\\[01;36m\\d{2}:\\d{2}:\\d{2}\033\\[0m]\\[\033\\[01;31mFATAL\033\\[0m] content\n$", []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(
|
||||
"^"
|
||||
"\\[\033\\[01;34m.*\033\\[0m\\]"
|
||||
"\\[\033\\[01;36m\\d{2}:\\d{2}:\\d{2}\033\\[0m\\]"
|
||||
"\\[\033\\[01;31mFATAL\033\\[0m\\]"
|
||||
" content\n"
|
||||
"$", []() { LOG(fatal) << "content"; });
|
||||
|
||||
Logger::SetVerbosity(Verbosity::veryhigh); // [process_name][HH:MM:SS:µS][severity][file:line:function] content
|
||||
CheckOutput("^\\[\033\\[01;34m.*\033\\[0m]\\[\033\\[01;36m\\d{2}:\\d{2}:\\d{2}\\.\\d{6}\033\\[0m]\\[\033\\[01;31mFATAL\033\\[0m]\\[\033\\[01;34m.*\033\\[0m:\033\\[01;33m\\d+\033\\[0m:\033\\[01;34m.*\033\\[0m] content\n$", []() { LOG(fatal) << "content"; });
|
||||
CheckOutput(
|
||||
"^"
|
||||
"\\[\033\\[01;34m.*\033\\[0m\\]"
|
||||
"\\[\033\\[01;36m\\d{2}:\\d{2}:\\d{2}\\.\\d{6}\033\\[0m\\]"
|
||||
"\\[\033\\[01;31mFATAL\033\\[0m\\]"
|
||||
"\\[\033\\[01;34m.*\033\\[0m:\033\\[01;33m\\d+\033\\[0m:\033\\[01;34m.*\033\\[0m\\]"
|
||||
" content\n"
|
||||
"$", []() { LOG(fatal) << "content"; });
|
||||
} catch (runtime_error& rte) {
|
||||
cout << rte.what() << endl;
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user