summaryrefslogtreecommitdiff
path: root/cpp/managementgen
diff options
context:
space:
mode:
authorCharles E. Rolke <chug@apache.org>2012-07-13 15:08:56 +0000
committerCharles E. Rolke <chug@apache.org>2012-07-13 15:08:56 +0000
commitbd6444f1b8255a59e79645135b4fef579ef4948b (patch)
tree190d01186baa7a32fd1143b9c3cbf0a7d17a85d3 /cpp/managementgen
parentd6f984ad6aa4a931806816d03b81c624e9ab6a70 (diff)
downloadqpid-python-bd6444f1b8255a59e79645135b4fef579ef4948b.tar.gz
QPID-4079 log entries track managed object life cycles
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1361262 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/managementgen')
-rwxr-xr-xcpp/managementgen/qmf-gen7
-rwxr-xr-xcpp/managementgen/qmfgen/generate.py3
-rw-r--r--cpp/managementgen/qmfgen/templates/Class.cpp24
3 files changed, 31 insertions, 3 deletions
diff --git a/cpp/managementgen/qmf-gen b/cpp/managementgen/qmf-gen
index 6e8f864256..2f0cc0d8fd 100755
--- a/cpp/managementgen/qmf-gen
+++ b/cpp/managementgen/qmf-gen
@@ -49,6 +49,8 @@ parser.add_option("-b", "--broker-plugin", dest="brokerplugin", default=False, a
help="Generate code for use in a qpid broker plugin")
parser.add_option("-2", "--v2-style", dest="v2_style", default=False, action="store_true",
help="Generate code for use with the QMFv2 Agent API")
+parser.add_option("-l", "--qpid-logs", dest="qpidlogs", default=False, action="store_true",
+ help="Generate code for QPID_LOG statements in classes constructor/destructor")
(opts, args) = parser.parse_args()
@@ -70,6 +72,11 @@ else:
vargs["agentHeaderDir"] = "agent"
vargs["genQmfV1"] = None
+if opts.qpidlogs:
+ vargs["genLogs"] = True
+else:
+ vargs["genLogs"] = False
+
for schemafile in args:
package = SchemaPackage(typefile, schemafile, opts)
diff --git a/cpp/managementgen/qmfgen/generate.py b/cpp/managementgen/qmfgen/generate.py
index 4e688e3bc7..61111be01d 100755
--- a/cpp/managementgen/qmfgen/generate.py
+++ b/cpp/managementgen/qmfgen/generate.py
@@ -304,6 +304,9 @@ class Generator:
def testGenQMFv1 (self, variables):
return variables["genQmfV1"]
+ def testGenLogs (self, variables):
+ return variables["genLogs"]
+
def genDisclaimer (self, stream, variables):
prefix = variables["commentPrefix"]
stream.write (prefix + " This source file was created by a code generator.\n")
diff --git a/cpp/managementgen/qmfgen/templates/Class.cpp b/cpp/managementgen/qmfgen/templates/Class.cpp
index 396812f2e0..d3033db7e1 100644
--- a/cpp/managementgen/qmfgen/templates/Class.cpp
+++ b/cpp/managementgen/qmfgen/templates/Class.cpp
@@ -7,9 +7,9 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -27,6 +27,9 @@
#include "qpid//*MGEN:Class.AgentHeaderLocation*//ManagementAgent.h"
#include "/*MGEN:Class.NameCap*/.h"
/*MGEN:Class.MethodArgIncludes*/
+/*MGEN:IF(Root.GenLogs)*/
+#include "qpid/log/Statement.h"
+/*MGEN:ENDIF*/
#include <iostream>
#include <sstream>
#include <string.h>
@@ -59,10 +62,26 @@ uint8_t /*MGEN:Class.NameCap*/::md5Sum[MD5_LEN] =
for (int idx = 0; idx < maxThreads; idx++)
perThreadStatsArray[idx] = 0;
/*MGEN:ENDIF*/
+/*MGEN:IF(Root.GenLogs)*/
+ QPID_LOG_CAT(trace, model, "Mgmt create " << className
+ << ". id:" << getKey());
+/*MGEN:ENDIF*/
}
/*MGEN:Class.NameCap*/::~/*MGEN:Class.NameCap*/ ()
{
+/*MGEN:IF(Root.GenLogs)*/
+ bool logEnabled;
+ QPID_LOG_TEST_CAT(trace, model, logEnabled);
+ if (logEnabled)
+ {
+ ::qpid::types::Variant::Map map;
+ mapEncodeValues(map, false, true);
+ QPID_LOG_CAT(trace, model, "Mgmt delete " << className
+ << ". id:" << getKey()
+ << " Statistics: " << map);
+ }
+/*MGEN:ENDIF*/
/*MGEN:IF(Class.ExistPerThreadStats)*/
for (int idx = 0; idx < maxThreads; idx++)
if (perThreadStatsArray[idx] != 0)
@@ -275,7 +294,6 @@ std::string /*MGEN:Class.NameCap*/::getKey() const
}
-
void /*MGEN:Class.NameCap*/::mapEncodeValues (::qpid::types::Variant::Map& _map,
bool includeProperties,
bool includeStatistics)