X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fpal_errors.py;h=a584088d2679c59f73e9b71ef2c787cb70ff007b;hp=649c86cde82cb3ffd74dcacb95b40de6ba20a630;hb=37ea2ceb606bdfc338cc76330cb9289c12f63852;hpb=c290ed5fb0f768b76213e6eb34d56f16abfeb54e diff --git a/resources/tools/presentation/pal_errors.py b/resources/tools/presentation/pal_errors.py index 649c86cde8..a584088d26 100644 --- a/resources/tools/presentation/pal_errors.py +++ b/resources/tools/presentation/pal_errors.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed 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: @@ -29,11 +29,13 @@ class PresentationError(Exception): - relevant data if there are any collected (optional parameter details). """ - log_exception = {u"DEBUG": logging.debug, - u"INFO": logging.info, - u"WARNING": logging.warning, - u"ERROR": logging.error, - u"CRITICAL": logging.critical} + log_level = { + u"DEBUG": logging.debug, + u"INFO": logging.info, + u"WARNING": logging.warning, + u"ERROR": logging.error, + u"CRITICAL": logging.critical + } def __init__(self, msg, details=u'', level=u"CRITICAL"): """Sets the exception message and the level. @@ -55,9 +57,9 @@ class PresentationError(Exception): self._level = level try: - self.log_exception[self._level](self._msg) + self.log_level[self._level](self._msg) if self._details: - self.log_exception[self._level](self._details) + self.log_level[self._level](self._details) except KeyError: print(u"Wrong log level.") sys.exit(1)