Boost logo

Boost :

Subject: Re: [boost] [log] Comments
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-03-16 07:35:57


Andrey Semashev wrote:
> On 03/15/2010 09:10 PM, Vladimir Prus wrote:
> > On Monday 15 March 2010 20:24:49 Andrey Semashev wrote:
> >>
> >>> * Why can't I use the library without named parameters? Surely,
> >>> there are low-tech ways to specify things.
> >>
> >> What are these?
> >
> > The simplest would be:
> >
> > file_log_parameters p;
> > p.filter = ... ;
> > p.formatter = ... ;
> > init_log_to_file(p);
> >
> > This is straightward for any user, produces clear error messages,
> > and is not much of a inconvenience.
>
> The filter is the property of the log frontend, and formatter is the
> property of the backend. Using named parameters allows to direct the
> appropriate parameters to their particular receivers. Also, it's more
> efficient than filling the structure.

Whether Boost.Parameters is the best solution, or as good as any other, for your purpose, don't forget the overhead of compilation time and errors. Template code is, of course, problematic when things go wrong. Parsing the compiler output is often difficult. A simpler, more straightforward solution, along the lines proposed by Vladimir, makes for simpler, more straightforward error messages, and can dramatically reduce compilation time.

> Log, in the common sense, is perceived as a file. Console is
> not a good place to write logs, since this is a place for user
> interaction, not for a protocol of execution.

I'll note again that this is a narrow view of the matter. We have many applications that log to stderr with the expectation that the command line invocation will redirect stderr to an appropriate file. It leaves the policy -- file pathname -- outside the application. We also have many applications that log to a file but use a command line option to specify the pathname, with a reserved value indicating stderr.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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