customize boost trivial logger

This commit is contained in:
Антон 2024-03-29 18:22:19 +03:00
parent 6f7808c3d4
commit 0ae24f6525
1 changed files with 5 additions and 7 deletions

View File

@ -28,6 +28,8 @@ using namespace std::literals;
namespace sys = boost::system;
namespace json = boost::json;
namespace http = boost::beast::http;
namespace keywords = boost::log::keywords;
using namespace std;
using namespace http_server;
using net::ip::tcp;
@ -96,14 +98,10 @@ void RunWorkers(unsigned n, const Fn& fn)
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(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;
BOOST_LOG_TRIVIAL(info) << "Server started!"sv;
const unsigned num_threads = std::thread::hardware_concurrency();