|
Boost : |
From: Dale Peakall (dale.peakall_at_[hidden])
Date: 2002-04-09 04:07:21
> > Please not that ugly format string again! Streams was invented to get
> > out of this cryptic, type-unsafe and processor-time-consuming feature,
> > so why not just to:
> >
> > log << log_debug << log_errno() << " config file not found";
>
> Which is more readable?
>
> cout << "CPU " << cpu_number << " (mem" << free_mem << "):
> multiply " << rows << " X " << cols << " matrix, mode = " << "'" <<
> transpose_mode << "'" << endl;
>
> versus
>
> printf("CPU %d (mem %d): multiply %d X %d matrix, mode = '%c'\n",
> cpu_number, free_mem, rows, cols, transpose_mode);
>
> Personally, I think the latter.
The point is that it's not type safe. On numerous occassions I've
turned up the logging level on a library using printf style format
specifiers to attempt to diagnose a problem, only for the whole
system to crash because there's a dodgy format string.
On the subject of other requirements, there's a need to support
many sinks: files, syslog, nt event log all spring to mind, there's
need for both logging levels and multiple
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk