customize boost trivial logger
This commit is contained in:
parent
6f7808c3d4
commit
0ae24f6525
12
main.cpp
12
main.cpp
|
@ -28,6 +28,8 @@ using namespace std::literals;
|
||||||
namespace sys = boost::system;
|
namespace sys = boost::system;
|
||||||
namespace json = boost::json;
|
namespace json = boost::json;
|
||||||
namespace http = boost::beast::http;
|
namespace http = boost::beast::http;
|
||||||
|
namespace keywords = boost::log::keywords;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace http_server;
|
using namespace http_server;
|
||||||
using net::ip::tcp;
|
using net::ip::tcp;
|
||||||
|
@ -96,14 +98,10 @@ void RunWorkers(unsigned n, const Fn& fn)
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
boost::log::add_file_log("./Logs.txt"s);
|
boost::log::add_file_log(keywords::file_name = "./public/my_logs.txt",
|
||||||
|
keywords::format = "[%TimeStamp%]: %Message%");
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "Message level trace"sv;
|
BOOST_LOG_TRIVIAL(info) << "Server started!"sv;
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Message level debug"sv;
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "Message level info"sv;
|
|
||||||
BOOST_LOG_TRIVIAL(warning) << "Message level warning"sv;
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "Message level error"sv;
|
|
||||||
BOOST_LOG_TRIVIAL(fatal) << "Message level fatal"sv;
|
|
||||||
|
|
||||||
const unsigned num_threads = std::thread::hardware_concurrency();
|
const unsigned num_threads = std::thread::hardware_concurrency();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue