From: Andrey Semashev (andysem_at_[hidden])
Date: 2007-04-10 12:24:34
Tuesday, April 10, 2007, 10:31:29 AM, you wrote:
> On Fri, 6 Apr 2007 23:49:25 +0400, Andrey Semashev wrote:
>> Hello Niko,
>> Friday, April 6, 2007, 2:12:41 PM, you wrote:
>> >> Well, there's no point to log an empty record. At least message
>> >> text should be present in any record, don't you think so?
>> > I don't think so. How about I define an new attribute for my logger
>> > which is some object that I want to convert to text and format
>> > lazily?
>> I don't see how is it different from message text. You just output
>> your object to the logger stream and see it in the log.
> If I may jump in here, I have worked on a system where we had the
> specific requirement Niko has come up with. We had an exception library
> which logged all exceptions thrown, along with the stack trace for the
> exception. However, the stack trace was only output if the minimum
> logging level was set to DEBUG1 or lower. As we had multiple streams of
> output, with differing logging levels on them, we couldn't just store
> the message text, as we needed to determine whether or not to output
> the stack trace on each stream.
You may output the stack trace as an attribute (in fact, such feature
is already requested). Then nothing prevents you from having two
sinks: the first that outputs everything on DEBUG1 or lower severity
with the trace, and the second outputs everything without it.
-- Best regards, Andrey mailto:andysem_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk