| 1 |
#define _XOPEN_SOURCE 500 |
| 2 |
|
| 3 |
#include <iostream> |
| 4 |
#include <boost/log/trivial.hpp> |
| 5 |
#include <boost/log/expressions.hpp> |
| 6 |
#include <boost/log/utility/setup/console.hpp> |
| 7 |
#include <boost/log/utility/setup/common_attributes.hpp> |
| 8 |
|
| 9 |
using namespace std; |
| 10 |
namespace logging = boost::log; |
| 11 |
|
| 12 |
void InitLogger() { |
| 13 |
logging::add_common_attributes(); |
| 14 |
logging::register_simple_formatter_factory<logging::trivial::severity_level, char>("Severity"); |
| 15 |
string log_format = "%TimeStamp% [%Severity%] - %Message%"; |
| 16 |
|
| 17 |
logging::add_console_log( |
| 18 |
cout, |
| 19 |
logging::keywords::format = log_format |
| 20 |
); |
| 21 |
} |
| 22 |
|
| 23 |
int main(int argc, char **argv) { |
| 24 |
InitLogger(); |
| 25 |
BOOST_LOG_TRIVIAL(trace) << "SOMETHING"; |
| 26 |
return 0; |
| 27 |
} |