Boost logo

Boost Users :

From: Benjamin de Dardel (benjamin.dedardel_at_[hidden])
Date: 2007-12-13 11:44:25


Thanks very much, It will be easier to make updates, rather than making
local changes for each new version of boost::logging !

Benjamin

John Torjo a écrit :
> Hi Benjamin,
>> Hi John, hi all
>>
>> As I don't know how to parameter boost::logging to flush messages in
>> rolling files, I modify the code as follow.
>>
>> My question is :
>> Is it absolutly necessary to change the code to do that ?
>>
>>
> I've updated the code.
> So, to manually flush:
>
> rolling_file f(...);
> f.flush();
>
> To automatically flush:
>
> rolling_file f( ...., rolling_file_settings().flush_each_time(true) );
>
> Best,
> John
>> Thanks,
>> Benjamin
>>
>> ///// rolling_file.hpp ///////
>>
>> void recreate_file() {...
>> m_cur_size = 0;
>> }
>>
>> template<class msg_type> void write( const msg_type& msg) {
>> convert_dest::write(msg, (*m_out) );
>>
>> // flush each time
>> m_cur_size += msg.size();
>> m_out->flush();
>> if ( m_cur_size > m_flags.max_size_bytes()) {
>> m_cur_idx = (m_cur_idx + 1) % m_flags.file_count();
>> recreate_file();
>> }
>> }
>>
>> size_t m_cur_size;
>>
>> //////////////////////////////////////
>>
>>
>> John Torjo a écrit :
>>
>>> Hi Benjamin,
>>>
>>>
>>>> Hi all,
>>>>
>>>>
>>>>
>>>>
>>> Glad you posted this here :)
>>>
>>>
>>>> Does anybody use boost::logging ?
>>>>
>>>> I wonder if it's possible to flush logs in a rolling_file as in a
>>>> standard file (flush_each_time) ?
>>>> It would be nice !
>>>>
>>>>
>>>>
>>>>
>>> Yes it would, and it can ;)
>>>
>>>
>>> Best,
>>> John
>>>
>>>
>>>
>>>
>>>
>>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden] <mailto:Boost-users_at_[hidden]>
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>>
>
>
> --
> http://John.Torjo.com -- C++ expert
> ... call me only if you want things done right
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net