Commit 25a5e43f authored by Dave Kuhlman's avatar Dave Kuhlman

Merged in...

Merged in andreif/generateds/andreif/setup-logging-only-when-running-as-scrip-1525614698597 (pull request #31)

Fix logging config.
parents d979e25b 7837b77d
......@@ -201,15 +201,8 @@ else:
import io
from functools import reduce
# Default logger configuration
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(message)s',
#filemode='w', # Can uncomment this line or change to append ('a')
#filename='generateDS.log' # uncomment to send messages to file
)
# Disable logging messages level INFO and below (includes DEBUG).
logging.disable(logging.INFO)
_log = logging.getLogger(__name__)
## import warnings
## warnings.warn('importing IPShellEmbed', UserWarning)
......@@ -1597,7 +1590,7 @@ class XschemaHandler(handler.ContentHandler):
def startElement(self, name, attrs):
global Targetnamespace, NamespacesDict, XsdNameSpace, fqnToElementDict
logging.debug("Start element: %s %s" % (name, repr(attrs.items())))
_log.debug("Start element: %s %s" % (name, repr(attrs.items())))
if len(self.stack) == 0 and self.firstElement:
self.firstElement = False
schemaNamespace = self.extractSchemaNamespace(attrs)
......@@ -1872,11 +1865,11 @@ class XschemaHandler(handler.ContentHandler):
elif name == DocumentationType:
if self.inAnnotationType:
self.inDocumentationType = 1
logging.debug("Start element stack: %d" % len(self.stack))
_log.debug("Start element stack: %d" % len(self.stack))
def endElement(self, name):
logging.debug("End element: %s" % (name))
logging.debug("End element stack: %d" % (len(self.stack)))
_log.debug("End element: %s" % (name))
_log.debug("End element stack: %d" % (len(self.stack)))
if name == SimpleTypeType: # and self.inSimpleType:
self.inSimpleType -= 1
if self.inAttribute:
......@@ -1958,14 +1951,14 @@ class XschemaHandler(handler.ContentHandler):
len(self.stack), ))
sys.exit(1)
if self.root: # change made to avoide logging error
logging.debug("Previous root: %s" % (self.root.name))
_log.debug("Previous root: %s" % (self.root.name))
else:
logging.debug("Prvious root: None")
_log.debug("Prvious root: None")
self.root = self.stack[0]
if self.root:
logging.debug("New root: %s" % (self.root.name))
_log.debug("New root: %s" % (self.root.name))
else:
logging.debug("New root: None")
_log.debug("New root: None")
elif name == SimpleContentType:
self.inSimpleContent = 0
elif name == ComplexContentType:
......@@ -4221,8 +4214,8 @@ def generateCtor(wrt, prefix, element):
mbrname = name + '_member'
else:
mbrname = name
logging.debug("Constructor child: %s" % name)
logging.debug("Dump: %s" % child.__dict__)
_log.debug("Constructor child: %s" % name)
_log.debug("Dump: %s" % child.__dict__)
childType = child.getType()
if childType == AnyTypeIdentifier:
if child.getMaxOccurs() > 1:
......@@ -4968,12 +4961,12 @@ FactoryMethodTemplate = """\
def generateClasses(wrt, prefix, element, delayed, nameSpacesDef=''):
logging.debug("Generating class for: %s" % element)
_log.debug("Generating class for: %s" % element)
mappedName = element.getFullyQualifiedName()
parentName, base = getParentName(element)
logging.debug("Element base: %s" % base)
_log.debug("Element base: %s" % base)
if not element.isExplicitDefine():
logging.debug("Not an explicit define, returning.")
_log.debug("Not an explicit define, returning.")
if element.isComplex() and element.getName() != element.getType():
MappingTypes[element.getName()] = element.getType()
return
......@@ -7463,7 +7456,13 @@ def main():
if __name__ == '__main__':
#logging.basicConfig(level=logging.DEBUG,)
# Default logger configuration
logging.basicConfig(
level=logging.WARNING,
format='%(asctime)s %(levelname)s %(message)s',
#filemode='w', # Can uncomment this line or change to append ('a')
#filename='generateDS.log' # uncomment to send messages to file
)
#import pdb; pdb.set_trace()
#import ipdb; ipdb.set_trace()
# use the following to debug after an exception (post mortem debbing).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment