Boost logo

Boost Users :

Subject: Re: [Boost-users] [log] Qt integration
From: Lindley French (lindleyf_at_[hidden])
Date: 2014-02-17 09:30:46

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 <olitour_at_[hidden]>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 <lindleyf_at_[hidden]> 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 <olitour_at_[hidden]>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_at_[hidden]
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at