aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/pal_errors.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2021-04-26 15:57:02 +0200
committerTibor Frank <tifrank@cisco.com>2021-05-03 08:20:06 +0000
commit37ea2ceb606bdfc338cc76330cb9289c12f63852 (patch)
treed67c7fafaaf165fc5fad3cb694d195a72c399fba /resources/tools/presentation/pal_errors.py
parentc290ed5fb0f768b76213e6eb34d56f16abfeb54e (diff)
PAL: Refactor the processing of spec and download
Change-Id: I204fdc3593a3702366727238f2b469d3d4320c2b Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/pal_errors.py')
-rw-r--r--resources/tools/presentation/pal_errors.py18
1 files changed, 10 insertions, 8 deletions
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)