boost-log

How to add color coding to boost::log console output?

允我心安 提交于 2020-05-10 19:40:21
问题 I'm trying to add colored log output for boost::log under linux. I read the following and I tried this: #define MY_LOG_ERROR() BOOST_LOG_TRIVIAL(error) << "\033[1;31" MY_LOG_ERROR() << "This is an error log." but it gives me the result below: [2016-07-11 17:23:16.328435] [0x00007f15f03d6780] [error] [1;31This is an error log. How to properly add colored log output to boost::log? 回答1: The proper way to customize output with Boost.Log is to use formatters. To set a formatter you will have to

How to add color coding to boost::log console output?

女生的网名这么多〃 提交于 2020-05-10 19:40:13
问题 I'm trying to add colored log output for boost::log under linux. I read the following and I tried this: #define MY_LOG_ERROR() BOOST_LOG_TRIVIAL(error) << "\033[1;31" MY_LOG_ERROR() << "This is an error log." but it gives me the result below: [2016-07-11 17:23:16.328435] [0x00007f15f03d6780] [error] [1;31This is an error log. How to properly add colored log output to boost::log? 回答1: The proper way to customize output with Boost.Log is to use formatters. To set a formatter you will have to

Simultaneous Logging to Console and File using Boost

社会主义新天地 提交于 2020-01-21 14:01:10
问题 I need help to initialize the boost logging framework to simultaneously log to both a named log file and also the console - (the named log file will not require periodic rotation or any of that fancy setup per many of the boost tutorials). The logging text should go to both sinks (file and console) simultaneously, however I need to format the console output slightly differently as it will be viewed by a user. I was able to get the basics of logging to 2 separate sinks working using the boost

Simultaneous Logging to Console and File using Boost

半腔热情 提交于 2020-01-21 13:59:08
问题 I need help to initialize the boost logging framework to simultaneously log to both a named log file and also the console - (the named log file will not require periodic rotation or any of that fancy setup per many of the boost tutorials). The logging text should go to both sinks (file and console) simultaneously, however I need to format the console output slightly differently as it will be viewed by a user. I was able to get the basics of logging to 2 separate sinks working using the boost

Simultaneous Logging to Console and File using Boost

我的梦境 提交于 2020-01-21 13:59:06
问题 I need help to initialize the boost logging framework to simultaneously log to both a named log file and also the console - (the named log file will not require periodic rotation or any of that fancy setup per many of the boost tutorials). The logging text should go to both sinks (file and console) simultaneously, however I need to format the console output slightly differently as it will be viewed by a user. I was able to get the basics of logging to 2 separate sinks working using the boost

Use of Boost.Log and Boost.ASIO causes a crash

陌路散爱 提交于 2020-01-15 04:38:09
问题 I am running into an issue where the use of Boost.Log in an app causes a crash or a hang when the app loads a shared library that uses Boost.ASIO! Any insights would be appreciated; a full cmake-buildable example is below. If the declaration of the global logger object in main.cpp is uncommented the program will either seg-fault immediately or the resolve() call will do nothing. If left commented out then the program works. I'm using Boost 1.55, g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4

How can I use Boost.Log across DLL boundaries?

不打扰是莪最后的温柔 提交于 2020-01-13 08:29:08
问题 I am trying to integrate Boost.Log in a fairly large application that is composed of a main application that dynamically loads plugins from DLLs. The initial idea was to pass a logging source to plugins so that they can add log messages. However, as soon as code from a DLL tries to log a message to the provided source, the application crashes with an access violation. Approach 1 The following minimal example illustrates the problem: int main(int argc, char* argv[]) { boost::log::sources:

How to correctly exit from a program, which uses Boost Log?

北城余情 提交于 2020-01-06 05:30:19
问题 The sample program below works fine, but the valgrind shows, that 520 bytes in 6 blocks are still reachable after exit. #include <iostream> #include <string> #include <boost/log/common.hpp> #include <boost/log/sources/logger.hpp> #include <boost/log/utility/setup/file.hpp> #include <boost/phoenix/bind/bind_member_function.hpp> #include <boost/shared_ptr.hpp> namespace bl = boost::log; namespace bp = boost::phoenix; enum class MySeverityLevel { panic, alert, critical, error, warning, notice,

Trying to find a way to LOG Graphical data in OpenCV/BOOST

半腔热情 提交于 2020-01-03 06:39:35
问题 To begin with: I am working on Image Processing using OpenCV C++. After loading a Mat image in a C++ program, I plotted a graph of the image using GNUPLOT. Now, The Requirement is to log the graphical data of the Mat image. To do this , I created a BOOST C++ Logger by including all BOOST Libraries. BOOST is an excellent library for Testing and logging data as well but, the problem with the it's Log is that it could log only text messages. Correct me if I'm wrong. Below is my CODE for plotting

Implementing an orthogonal log level that gets dumped into a socket

懵懂的女人 提交于 2020-01-02 13:34:53
问题 I'm using boost log and want to implement an extra log level that is independent of the existing log levels. This log level will be activated on-demand, if there is a listening client connected to the daemons socket (independent of the current configured log level). Is this possible to implement? I suspect that the on-demand functionality can be implemented through a custom sink that will either discard, or send the data. But how do I integrate this with the rest of the logging code? 回答1: Let