On Mon, 2002-10-28 at 11:51, Adrian Chadd wrote:
> On Mon, Oct 28, 2002, Robert Collins wrote:
>
> If we're going to do that, we might as well look at doing the
> whole syslog-level thing as well for some coarse-grained/multilogfile
> output.
>
> ie, something like:
>
> debug(flags, section, level) (foo);
>
> where flags is something like DEBUG_INFO, DEBUG_WARNING,
> DEBUG_NOTICE, DEBUG_ERROR..
If we are going to change the interface, lets make it extensible:
class Log {
public:
enum Type(INFO, WARNING, NOTICE, ERROR);
Log(int aSection = 0, int aLevel = 0, Type aType = INFO):
section(aSection), level(aLevel), type (aType) {}
bool operator () const
{
return level > debugLevels[SECTION];
}
};
We can then define trace:
#define trace (LOG, ...)
(LOG() ? (void) 0 : \
_db_print_trace(__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
The point being that we can then extend this without needing massive
copy and pastes or adjustments in the future.
A use might look like :
trace (Log(99,5), "foobar %S", "somestring");
Rob
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:17:01 MST