]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Logger/Log.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Logger / Log.py
index 407a1b32b6eeb8f653d90623e6c834831d83d081..e8c31f00720be14565cad95445b5ee75042b3ca5 100644 (file)
@@ -1,11 +1,11 @@
 ## @file\r
 # This file implements the log mechanism for Python tools.\r
 #\r
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\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
+# 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
@@ -134,7 +134,7 @@ def Debug(Level, Message, ExtraData=None):
         "msg"       : Message,\r
     }\r
 \r
-    if ExtraData != None:\r
+    if ExtraData is not None:\r
         LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict + "\n    %s" % ExtraData\r
     else:\r
         LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict\r
@@ -165,10 +165,10 @@ def Warn(ToolName, Message, File=None, Line=None, ExtraData=None):
     #\r
     # if no tool name given, use caller's source file name as tool name\r
     #\r
-    if ToolName == None or ToolName == "":\r
+    if ToolName is None or ToolName == "":\r
         ToolName = os.path.basename(extract_stack()[-2][0])\r
 \r
-    if Line == None:\r
+    if Line is None:\r
         Line = "..."\r
     else:\r
         Line = "%d" % Line\r
@@ -180,12 +180,12 @@ def Warn(ToolName, Message, File=None, Line=None, ExtraData=None):
         "msg"       : Message,\r
     }\r
 \r
-    if File != None:\r
+    if File is not None:\r
         LogText = _WARNING_MESSAGE_TEMPLATE % TemplateDict\r
     else:\r
         LogText = _WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict\r
 \r
-    if ExtraData != None:\r
+    if ExtraData is not None:\r
         LogText += "\n    %s" % ExtraData\r
 \r
     _INFO_LOGGER.log(WARN, LogText)\r
@@ -197,8 +197,8 @@ def Warn(ToolName, Message, File=None, Line=None, ExtraData=None):
 \r
 ## Log ERROR message\r
 #\r
-# Once an error messages is logged, the tool's execution will be broken by \r
-# raising an execption. If you don't want to break the execution later, you \r
+# Once an error messages is logged, the tool's execution will be broken by\r
+# raising an execption. If you don't want to break the execution later, you\r
 # can give "RaiseError" with "False" value.\r
 #\r
 #   @param  ToolName    The name of the tool. If not given, the name of caller\r
@@ -215,18 +215,18 @@ def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
           ExtraData=None, RaiseError=IS_RAISE_ERROR):\r
     if ToolName:\r
         pass\r
-    if Line == None:\r
+    if Line is None:\r
         Line = "..."\r
     else:\r
         Line = "%d" % Line\r
 \r
-    if Message == None:\r
+    if Message is None:\r
         if ErrorCode in gERROR_MESSAGE:\r
             Message = gERROR_MESSAGE[ErrorCode]\r
         else:\r
             Message = gERROR_MESSAGE[UNKNOWN_ERROR]\r
 \r
-    if ExtraData == None:\r
+    if ExtraData is None:\r
         ExtraData = ""\r
 \r
     TemplateDict = {\r
@@ -238,7 +238,7 @@ def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
         "extra"     : ExtraData\r
     }\r
 \r
-    if File != None:\r
+    if File is not None:\r
         LogText =  _ERROR_MESSAGE_TEMPLATE % TemplateDict\r
     else:\r
         LogText = __ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict\r
@@ -248,13 +248,13 @@ def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
     if RaiseError:\r
         raise FatalError(ErrorCode)\r
 \r
-    \r
+\r
 ## Initialize log system\r
 #\r
 def Initialize():\r
     #\r
-    # Since we use different format to log different levels of message into \r
-    # different place (stdout or stderr), we have to use different "Logger" \r
+    # Since we use different format to log different levels of message into\r
+    # different place (stdout or stderr), we have to use different "Logger"\r
     # objects to do this.\r
     #\r
     # For DEBUG level (All DEBUG_0~9 are applicable)\r