Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2005-08-18 08:55:07


> Now, that example can be modified to write to the logging stream
> directly using this:
>
> std::copy(v.begin(), v.end(),
> std::ostream_iterator<int>(*<some-log>().stream().stream(), ", "));
> BOOST_LOGL(<some-log>, my_error) << "\n";
>
> First question - is this usage that you envisaged? . Secondly, the output is
>
> 09:30:35 [app] 0, 1, 2, 3, 09:30:35 [app]
>
> rather than
>
> 09:30:35 [app] 0, 1, 2, 3,
>
> because of the second log statement prepending the time before the
> "\n". Is there any way of getting the required output using the above
> code pattern, by somehow stopping the log modifiers?
>

I guess the simplest way is to write to a std::ostringstream first.

Best,
John

-- 
John Torjo,    Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/ -v1.6.3 (Resource Splitter)
-- http://www.torjo.com/cb/ - Click, Build, Run!

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk