|
Boost Users : |
Subject: [Boost-users] How to make Boost.Format fault tolerant?
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2012-02-09 23:14:32
A common case for using Boost.Format is in the production of error or warning messages.
So, these don't get run on a normal use of the program, and problems with the arguments
will go unnoticed until there _is_ an error, in which case I get (at best) no error
message, or worse, turn a log-only warning statement into an exception.
Does Format already have some features to make it not throw exceptions? Idealy, for
messages that go into a log or are used to diagnose some program bug, any information is
better than none and I'd like to see what it did get as best as it can, and not worry
about how pretty it may be. So missing arguments use a default placeholder text instead,
and extra arguments without specifiers in the format string just get appended with spaces
in between, and any formatting spec error just goes back to default string, and any error
during that gives a placeholder but the other arguments are processed.
âJohn
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