|
Boost : |
From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2005-05-19 16:00:33
On 5/19/05, Gennadiy Rozental <gennadiy.rozental_at_[hidden]> wrote:
> > > 4. What kind of overhead it introduces? Now instead of directly
> > writing into stream we keep second copy of every piece of log essentially doubling
> > the memory usage and increasing log overhead, isn't it?
> >
> > Have you actually tested it in a multi-threading environment, or is this
> > just your guts?
>
> How MT is related to my question? You introduces extra buffering level. I am
> asking how efficient it is.
There should be no doubling of messages, though they are copied from
one place to another. Generally messages are formatted in a temporary
ostringstream and then written to files or other sinks via appender
functions.
user code -> ostringstream -> modifier functions (if any) -> appenders
There is a special appender called ts_appender that buffers formatted
messages in a string until the time arrives to flush them to their
ultimate destination.
user code -> ostringstream -> modifier functions (if any) -> string buffer
[background thread]: string buffer -> appenders
-- Caleb Epstein caleb dot epstein at gmail dot com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk