## @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
"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
#\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
"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
\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
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
"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
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