[log] Qt integration
Hi all, I would like to use boost::log within a Qt based application. For now, I simply want to redirect the output of BOOST_LOG_TRIVIAL(xxx) macro to a QTextEdit. What is the easiest way to do that? Is there a way to get the logger output string? Best regards
You can create a custom sink backend easily enough in Boost.Log. I don't
know if you can use it with BOOST_LOG_TRIVIAL, though.
On Sat, Feb 15, 2014 at 5:58 PM, Olivier Tournaire
Hi all,
I would like to use boost::log within a Qt based application. For now, I simply want to redirect the output of BOOST_LOG_TRIVIAL(xxx) macro to a QTextEdit. What is the easiest way to do that?
Is there a way to get the logger output string?
Best regards
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks Lindley,
I am new to boost::log and, even after reading the doc, I am still
confused. Could you please help me to start?
I really do not understand how to glue a QTextEdit with a custom sink.
Regards
Le dimanche 16 février 2014, Lindley French
You can create a custom sink backend easily enough in Boost.Log. I don't know if you can use it with BOOST_LOG_TRIVIAL, though.
On Sat, Feb 15, 2014 at 5:58 PM, Olivier Tournaire
javascript:_e(%7B%7D,'cvml','olitour@gmail.com'); wrote:
Hi all,
I would like to use boost::log within a Qt based application. For now, I simply want to redirect the output of BOOST_LOG_TRIVIAL(xxx) macro to a QTextEdit. What is the easiest way to do that?
Is there a way to get the logger output string?
Best regards
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.orgjavascript:_e(%7B%7D,'cvml','Boost-users@lists.boost.org'); http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost.Log can be a bit overwhelming at first glance. The short version is:
1) Every log record is associated with a set of attributes. The logged
message is one of the attributes.
2) A logger object (called a "source" in the docs) can be configured to
attach more attributes to records logged through it.
3) A "sink" can be configured to accept records with specified attribute
conditions. Sinks define logging outputs----files, syslog, QTextEdits, etc.
4) Sinks are divided into frontends and backends. The main point of the
frontend is to provide thread safety for the backend, and generally all you
need to do is decide if you need thread safety, and if you want to achieve
it by locking (synchronous_sink) or by running the backend in a background
thread (asynchronous_sink). The backend is where the actual stuff happens,
and you would need to write a custom one for a QTextEdit.
You'll also need to read up on filters and formatters, which are remarkably
easy to specify but might take a few minutes to get your head around.
Filters determine which records are sent to a given sink, and formatters
convert the set of attributes in the record into a string for output.
On Mon, Feb 17, 2014 at 8:05 AM, Olivier Tournaire
Thanks Lindley,
I am new to boost::log and, even after reading the doc, I am still confused. Could you please help me to start? I really do not understand how to glue a QTextEdit with a custom sink.
Regards
Le dimanche 16 février 2014, Lindley French
a écrit : You can create a custom sink backend easily enough in Boost.Log. I don't
know if you can use it with BOOST_LOG_TRIVIAL, though.
On Sat, Feb 15, 2014 at 5:58 PM, Olivier Tournaire
wrote: Hi all,
I would like to use boost::log within a Qt based application. For now, I simply want to redirect the output of BOOST_LOG_TRIVIAL(xxx) macro to a QTextEdit. What is the easiest way to do that?
Is there a way to get the logger output string?
Best regards
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thank you. For sure there are a lot of concepts to understand. I might have
miss in my first reading the consume() method for sink backends. Your
message points me the right direction to start.
Regards
Le lundi 17 février 2014, Lindley French
Boost.Log can be a bit overwhelming at first glance. The short version is:
1) Every log record is associated with a set of attributes. The logged message is one of the attributes. 2) A logger object (called a "source" in the docs) can be configured to attach more attributes to records logged through it. 3) A "sink" can be configured to accept records with specified attribute conditions. Sinks define logging outputs----files, syslog, QTextEdits, etc. 4) Sinks are divided into frontends and backends. The main point of the frontend is to provide thread safety for the backend, and generally all you need to do is decide if you need thread safety, and if you want to achieve it by locking (synchronous_sink) or by running the backend in a background thread (asynchronous_sink). The backend is where the actual stuff happens, and you would need to write a custom one for a QTextEdit.
You'll also need to read up on filters and formatters, which are remarkably easy to specify but might take a few minutes to get your head around. Filters determine which records are sent to a given sink, and formatters convert the set of attributes in the record into a string for output.
On Mon, Feb 17, 2014 at 8:05 AM, Olivier Tournaire
javascript:_e(%7B%7D,'cvml','olitour@gmail.com'); wrote:
Thanks Lindley,
I am new to boost::log and, even after reading the doc, I am still confused. Could you please help me to start? I really do not understand how to glue a QTextEdit with a custom sink.
Regards
Le dimanche 16 février 2014, Lindley French
javascript:_e(%7B%7D,'cvml','lindleyf@gmail.com');> a écrit : You can create a custom sink backend easily enough in Boost.Log. I don't
know if you can use it with BOOST_LOG_TRIVIAL, though.
On Sat, Feb 15, 2014 at 5:58 PM, Olivier Tournaire
wrote: Hi all,
I would like to use boost::log within a Qt based application. For now, I simply want to redirect the output of BOOST_LOG_TRIVIAL(xxx) macro to a QTextEdit. What is the easiest way to do that?
Is there a way to get the logger output string?
Best regards
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.orgjavascript:_e(%7B%7D,'cvml','Boost-users@lists.boost.org'); http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thank you. For sure there are a lot of concepts to understand. I might have
miss in my first reading the consume() method for sink backends. Your
message points me the right direction to start.
Regards
Le lundi 17 février 2014, Lindley French
Boost.Log can be a bit overwhelming at first glance. The short version is:
1) Every log record is associated with a set of attributes. The logged message is one of the attributes. 2) A logger object (called a "source" in the docs) can be configured to attach more attributes to records logged through it. 3) A "sink" can be configured to accept records with specified attribute conditions. Sinks define logging outputs----files, syslog, QTextEdits, etc. 4) Sinks are divided into frontends and backends. The main point of the frontend is to provide thread safety for the backend, and generally all you need to do is decide if you need thread safety, and if you want to achieve it by locking (synchronous_sink) or by running the backend in a background thread (asynchronous_sink). The backend is where the actual stuff happens, and you would need to write a custom one for a QTextEdit.
You'll also need to read up on filters and formatters, which are remarkably easy to specify but might take a few minutes to get your head around. Filters determine which records are sent to a given sink, and formatters convert the set of attributes in the record into a string for output.
On Mon, Feb 17, 2014 at 8:05 AM, Olivier Tournaire
javascript:_e(%7B%7D,'cvml','olitour@gmail.com'); wrote:
Thanks Lindley,
I am new to boost::log and, even after reading the doc, I am still confused. Could you please help me to start? I really do not understand how to glue a QTextEdit with a custom sink.
Regards
Le dimanche 16 février 2014, Lindley French
javascript:_e(%7B%7D,'cvml','lindleyf@gmail.com');> a écrit : You can create a custom sink backend easily enough in Boost.Log. I don't
know if you can use it with BOOST_LOG_TRIVIAL, though.
On Sat, Feb 15, 2014 at 5:58 PM, Olivier Tournaire
wrote: Hi all,
I would like to use boost::log within a Qt based application. For now, I simply want to redirect the output of BOOST_LOG_TRIVIAL(xxx) macro to a QTextEdit. What is the easiest way to do that?
Is there a way to get the logger output string?
Best regards
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.orgjavascript:_e(%7B%7D,'cvml','Boost-users@lists.boost.org'); http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Lindley French
-
Olivier Tournaire