add new log function
This commit is contained in:
40
bin/examples/exception/main.cpp
Normal file
40
bin/examples/exception/main.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <vector>
|
||||
#include "hack/exception/exception.hpp"
|
||||
#include "hack/logger/logger.hpp"
|
||||
|
||||
auto main(int argc, char *argv[]) -> int
|
||||
{
|
||||
try
|
||||
{
|
||||
hack::exception e;
|
||||
e.title("Test exception");
|
||||
e.description("Super description for test exception");
|
||||
e.service("example");
|
||||
std::vector<int> vi = { 1, 2, 3 };
|
||||
e.set("vector int", vi);
|
||||
e.set("int", 1);
|
||||
e.set("float", 1.13f);
|
||||
e.set("double", 1.23);
|
||||
|
||||
// struct user_type
|
||||
// {
|
||||
// int i = 1;
|
||||
// std::string str = "user type";
|
||||
//
|
||||
// auto get_logger_data()
|
||||
// {
|
||||
// return std::make_tuple(i, str);
|
||||
// }
|
||||
// } ut;
|
||||
//
|
||||
// e.set("user type", ut);
|
||||
throw e;
|
||||
}
|
||||
catch(hack::exception& e)
|
||||
{
|
||||
hack::log()(e);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user