Boost logo

Boost :

Subject: [boost] [Log] Pre-review questions
From: Christian Holmquist (c.holmquist_at_[hidden])
Date: 2010-03-14 11:29:21


Hi,

I'm currently attempting to convert parts of our production log system to
using Boost.Log as part of my review. At first glance this looked like a
trivial thing, since Boost.Log supports all features (and more!) than I
would need to do this task. However, I can't find what I'm looking for in
the docs and I wish to not poke around anymore in the Boost.Log code.

Simple task 1
I've two source level attributes, System and Severity. I wish to create a
log macro that takes these two arguments.

enum System
{
   SYSTEM_A,
   SYSTEM_B,
};

enum SeverityLevel // I don't want to use the built-in severity enum, since
need flexibility to add/remove levels.
{
   FREQUENT,
   DEBUG,
   TEMP,
   INFO,
   WARNING,
   ERROR,
};

void foo()
{
  LOG(SYSTEM_A, INFO, "Hello cruel world" << "!");
}

The above is not a complicated scenario and I should be able to quickly find
an answer. Maybe I've just missed it..:)

Simple task 2
Create a custom filter without using any Lambda magic.

struct Filter
{
   System sys;
   SeverityLevel sev;

  bool operator()(???)
  {
    // pseudo-code, since I don't know how to write this
    return Attributes["System"] == sys && Attributes["SeverityLevel"] >=
sev;
  }
};

Help appreciated, I would like to get to the more complicated parts..

/ Christian


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