Add ElogWithMetaDataCapture class

This callback class will create an error log with
exactly 1 metadata field, which takes a string.  This
metadata field will be filled in with the property paths,
names, and values of the properties that passed the
condition checks that caused the callback to be called
in the first place.

Tested: Ran with YAML rules that used this callback and
        checked that everything worked as specified.

Change-Id: Ib37206c63385939c583a09e7ba979d6e016691f6
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/src/pdmgen.py b/src/pdmgen.py
index 7487015..55df3e3 100755
--- a/src/pdmgen.py
+++ b/src/pdmgen.py
@@ -718,6 +718,29 @@
             c=self,
             indent=indent)
 
+
+class ElogWithMetadata(Callback, Renderer):
+    '''Handle the elog_with_metadata callback config file directive.'''
+
+    def __init__(self, *a, **kw):
+        self.error = kw.pop('error')
+        self.metadata = kw.pop('metadata')
+        super(ElogWithMetadata, self).__init__(**kw)
+
+    def construct(self, loader, indent):
+        with open('errors.hpp', 'a') as fd:
+            fd.write(
+                self.render(
+                    loader,
+                    'errors.mako.hpp',
+                    c=self))
+        return self.render(
+            loader,
+            'elog_with_metadata.mako.cpp',
+            c=self,
+            indent=indent)
+
+
 class ResolveCallout(Callback, Renderer):
     '''Handle the 'resolve callout' callback config file directive.'''
 
@@ -901,6 +924,7 @@
             'callback': {
                 'journal': Journal,
                 'elog': Elog,
+                'elog_with_metadata': ElogWithMetadata,
                 'event': Event,
                 'group': GroupOfCallbacks,
                 'method': Method,