Commit d3113c52 authored by thomas.forbriger's avatar thomas.forbriger

ThiesDL1 [WP][FEATURE]: provide syslog test program

parent e4020e5e
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "thiesdl1.h" #include "thiesdl1.h"
#include "functions.h" #include "functions.h"
#include "memory.h" #include "memory.h"
#include "logger.h"
typedef std::list<std::string> Tlistofstring; typedef std::list<std::string> Tlistofstring;
...@@ -83,6 +84,8 @@ int main(int iargc, char* argv[]) ...@@ -83,6 +84,8 @@ int main(int iargc, char* argv[])
"flags:\n" "flags:\n"
"-v be verbose\n" "-v be verbose\n"
"-active set active flag for dl1::mkpathname in test \"-preppath\"\n" "-active set active flag for dl1::mkpathname in test \"-preppath\"\n"
"-loginfo set syslog level to info\n"
"-logemerg set syslog level to emerg\n"
"\n" "\n"
"tests:\n" "tests:\n"
"-pattern p test pattern replacement function\n" "-pattern p test pattern replacement function\n"
...@@ -93,6 +96,7 @@ int main(int iargc, char* argv[]) ...@@ -93,6 +96,7 @@ int main(int iargc, char* argv[])
"-checkfileexists f test functions in tfxx::file\n" "-checkfileexists f test functions in tfxx::file\n"
"-preppath p test function\n" "-preppath p test function\n"
" dl1::mkpathname\n" " dl1::mkpathname\n"
"-syslog s send string \"s\" to syslog\n"
}; };
// define commandline options // define commandline options
...@@ -115,6 +119,12 @@ int main(int iargc, char* argv[]) ...@@ -115,6 +119,12 @@ int main(int iargc, char* argv[])
{"preppath",arg_yes,"-"}, {"preppath",arg_yes,"-"},
// 7: set active flag // 7: set active flag
{"active",arg_no,"-"}, {"active",arg_no,"-"},
// 8: send string to syslog
{"syslog",arg_yes,"-"},
// 9: set syslog level to info
{"loginfo",arg_no,"-"},
// 10: set syslog level to emerg
{"logemerg",arg_no,"-"},
{NULL} {NULL}
}; };
...@@ -201,6 +211,31 @@ int main(int iargc, char* argv[]) ...@@ -201,6 +211,31 @@ int main(int iargc, char* argv[])
cmdline.optset(7)); cmdline.optset(7));
cout << "file path: " << pathname << endl; cout << "file path: " << pathname << endl;
} }
/* ====================================================================== */
if (cmdline.optset(8))
{
dl1::Logger::setident("DL1logger");
if (cmdline.optset(9))
{
dl1::Logger(dl1::log_info) << TESTER_VERSION;
dl1::Logger(dl1::log_info) << "logging at info level";
dl1::Logger(dl1::log_info) << cmdline.string_arg(8);
}
else if (cmdline.optset(10))
{
dl1::Logger(dl1::log_emerg) << TESTER_VERSION;
dl1::Logger(dl1::log_emerg) << "logging at emerg level";
dl1::Logger(dl1::log_emerg) << cmdline.string_arg(8);
}
else
{
dl1::Logger() << TESTER_VERSION;
dl1::Logger() << "logging at default level";
dl1::Logger() << cmdline.string_arg(8);
}
}
} }
/* ----- END OF tester.cc ----- */ /* ----- END OF tester.cc ----- */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment