diff options
| author | Charles E. Rolke <chug@apache.org> | 2012-07-13 15:08:56 +0000 |
|---|---|---|
| committer | Charles E. Rolke <chug@apache.org> | 2012-07-13 15:08:56 +0000 |
| commit | 895f911bea116e3803e42252da364c1ae71b9d17 (patch) | |
| tree | de0d76f3bd6186899525ef44b46657fa6811dcf3 /qpid/cpp/managementgen | |
| parent | 4dafd3cc40c262c13a53fc4ae853413a64aaa1cb (diff) | |
| download | qpid-python-895f911bea116e3803e42252da364c1ae71b9d17.tar.gz | |
QPID-4079 log entries track managed object life cycles
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1361262 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/managementgen')
| -rwxr-xr-x | qpid/cpp/managementgen/qmf-gen | 7 | ||||
| -rwxr-xr-x | qpid/cpp/managementgen/qmfgen/generate.py | 3 | ||||
| -rw-r--r-- | qpid/cpp/managementgen/qmfgen/templates/Class.cpp | 24 |
3 files changed, 31 insertions, 3 deletions
diff --git a/qpid/cpp/managementgen/qmf-gen b/qpid/cpp/managementgen/qmf-gen index 6e8f864256..2f0cc0d8fd 100755 --- a/qpid/cpp/managementgen/qmf-gen +++ b/qpid/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/qpid/cpp/managementgen/qmfgen/generate.py b/qpid/cpp/managementgen/qmfgen/generate.py index 4e688e3bc7..61111be01d 100755 --- a/qpid/cpp/managementgen/qmfgen/generate.py +++ b/qpid/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/qpid/cpp/managementgen/qmfgen/templates/Class.cpp b/qpid/cpp/managementgen/qmfgen/templates/Class.cpp index 396812f2e0..d3033db7e1 100644 --- a/qpid/cpp/managementgen/qmfgen/templates/Class.cpp +++ b/qpid/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) |
