--- /dev/null
+## @file\r
+#\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
+#\r
+# This program and the accompanying materials are licensed and made available\r
+# under the terms and conditions of the BSD License which accompanies this\r
+# distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+\r
+def GetEdkLogger():\r
+ import logging\r
+ return logging.getLogger('edk')\r
+\r
+class EdkException(Exception):\r
+ def __init__(self, message, fName=None, fNo=None):\r
+ self._message = message\r
+ ErrorMsg(message, fName, fNo)\r
+\r
+ def GetMessage(self):\r
+ return '[EDK Failure]: %s' %self._message\r
+\r
+def ErrorMsg(mess, fName=None, fNo=None):\r
+ GetEdkLogger().error(NormalMessage('#ERR#', mess, fName, fNo))\r
+\r
+def LogMsg(mess, fName=None, fNo=None):\r
+ GetEdkLogger().info(NormalMessage('@LOG@', mess, fName, fNo))\r
+\r
+def WarnMsg(mess, fName=None, fNo=None):\r
+ GetEdkLogger().warning(NormalMessage('!WAR!', mess, fName, fNo))\r
+\r
+def NormalMessage(type, mess, fName=None, fNo=None):\r
+ strMsg = type\r
+\r
+ if fName != None:\r
+ strMsg += ' %s' % fName.replace('/', '\\')\r
+ if fNo != None:\r
+ strMsg += '(%d):' % fNo\r
+ else:\r
+ strMsg += ' :'\r
+\r
+ if fName == None and fNo == None:\r
+ strMsg += ' '\r
+ strMsg += mess\r
+\r
+ return strMsg\r
+\r
+\r
+\r