|
Boost : |
From: Boris (boriss_at_[hidden])
Date: 2008-08-20 15:07:18
On Wed, 20 Aug 2008 20:36:47 +0200, Andrey Semashev
<andrey.semashev_at_[hidden]> wrote:
> [...]
>> If I build it with VC++ 9.0 SP1 the file test.txt contains afterwards:
>>
>> [] message
>>
>> Only if I use boost::log::formatters::date_time("TimeStamp") the
>> timestamp is written.
>
> This is not a bug. The problem is that you used attr formatter without
> specifying date type. The attr formatter by default supports most
> fundamental types and strings. For other types the attribute value type
> (or set of types) must be specified explicitly:
>
> boost::log::formatters::attr< boost::posix_time::ptime >("TimeStamp")
>
>
> As for the date_time formatter, it implicitly supports all date and time
> types defined in the library documentation, which includes ptime. That's
> why it worked right away.
Thanks for the explanation! I'm not sure if I had found out without your
help. I don't know about others but maybe my questions here help to
improve the (already pretty good) documentation. Or is this explained
already somewhere that I just missed it?
Boris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk